html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

[data-bs-theme="dark"] {
  --bs-body-bg: #0b1220;
  --bs-body-color: #e6edf7;
  --bs-tertiary-bg: #121a2b;
  --bs-secondary-bg: #18233a;
  --bs-border-color: #2a3a59;
  --bs-primary: #7c4dff;
  --bs-primary-rgb: 124, 77, 255;
  --bs-link-color: #8fb5ff;
  --bs-link-hover-color: #b3ceff;
}

body {
  margin-bottom: 60px;
}

[data-bs-theme="dark"] .navbar,
[data-bs-theme="dark"] .footer {
  background-color: #0f1829 !important;
}

[data-bs-theme="dark"] .btn-primary {
  --bs-btn-bg: #7c4dff;
  --bs-btn-border-color: #7c4dff;
  --bs-btn-hover-bg: #9268ff;
  --bs-btn-hover-border-color: #9268ff;
  --bs-btn-active-bg: #6d41e6;
  --bs-btn-active-border-color: #6d41e6;
}

[data-bs-theme="dark"] .btn-outline-primary {
  --bs-btn-color: #9ab9ff;
  --bs-btn-border-color: #5c79b8;
  --bs-btn-hover-bg: #2b3d63;
  --bs-btn-hover-border-color: #7a9ae0;
}

[data-bs-theme="dark"] .badge.text-bg-secondary {
  background-color: #2e3b56 !important;
  color: #d9e4ff !important;
}

[data-bs-theme="dark"] .card {
  border-color: rgba(255, 255, 255, 0.12);
}

[data-bs-theme="dark"] .list-group-item {
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  border-color: rgba(255, 255, 255, 0.12);
}

.article-read-shell {
  max-width: 960px;
  margin: 0 auto;
}

.article-read-content {
  background: var(--bs-tertiary-bg);
  border-radius: 0.75rem;
  padding: 1.25rem;
}

.article-read-heading {
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
  font-size: 1.35rem;
}

.article-read-paragraph {
  line-height: 1.65;
  margin-bottom: 1rem;
  white-space: pre-wrap;
}

.article-read-richtext {
  line-height: 1.65;
  margin-bottom: 1rem;
}

.article-read-richtext p,
.article-read-richtext ul,
.article-read-richtext ol {
  margin-bottom: 0.6rem;
}

.article-read-richtext ul,
.article-read-richtext ol {
  padding-left: 1.4rem;
}

.article-read-richtext p:last-child,
.article-read-richtext ul:last-child,
.article-read-richtext ol:last-child {
  margin-bottom: 0;
}

.article-read-content a {
  text-decoration: underline;
  text-underline-offset: 0.15rem;
}

.article-read-content a.external-link::after {
  content: " ↗";
  font-size: 0.85em;
}

.article-read-code {
  margin-bottom: 1rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;
  overflow: hidden;
}

.article-read-code-header {
  padding: 0.5rem 0.75rem;
  background: var(--bs-secondary-bg);
  color: var(--bs-secondary-color);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.article-read-code pre {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: auto 1fr;
}

.article-read-code .line-numbers {
  padding: 1rem 0.6rem;
  border-right: 1px solid var(--bs-border-color);
  color: var(--bs-secondary-color);
  background: var(--bs-tertiary-bg);
  text-align: right;
  user-select: none;
  min-width: 2.6rem;
}

.article-read-code .line-numbers span,
.article-read-code .code-content .code-line {
  display: block;
  line-height: 1.45rem;
}

.article-read-code .code-content {
  display: block;
  padding: 1rem;
  overflow-x: auto;
}

.article-read-code .code-content .code-line {
  white-space: pre;
}

.article-read-code .hljs {
  background: transparent;
  color: var(--bs-body-color);
}

[data-bs-theme="light"] .article-read-code .hljs-keyword,
[data-bs-theme="light"] .article-read-code .hljs-selector-tag,
[data-bs-theme="light"] .article-read-code .hljs-literal {
  color: #7c3aed;
}

[data-bs-theme="light"] .article-read-code .hljs-string,
[data-bs-theme="light"] .article-read-code .hljs-title,
[data-bs-theme="light"] .article-read-code .hljs-section,
[data-bs-theme="light"] .article-read-code .hljs-attribute {
  color: #0f766e;
}

[data-bs-theme="light"] .article-read-code .hljs-comment,
[data-bs-theme="light"] .article-read-code .hljs-quote {
  color: #6b7280;
}

[data-bs-theme="dark"] .article-read-code .hljs-keyword,
[data-bs-theme="dark"] .article-read-code .hljs-selector-tag,
[data-bs-theme="dark"] .article-read-code .hljs-literal {
  color: #c084fc;
}

[data-bs-theme="dark"] .article-read-code .hljs-string,
[data-bs-theme="dark"] .article-read-code .hljs-title,
[data-bs-theme="dark"] .article-read-code .hljs-section,
[data-bs-theme="dark"] .article-read-code .hljs-attribute {
  color: #5eead4;
}

[data-bs-theme="dark"] .article-read-code .hljs-comment,
[data-bs-theme="dark"] .article-read-code .hljs-quote {
  color: #94a3b8;
}

[data-bs-theme="light"] .article-read-code .token-keyword {
  color: #7c3aed;
}

[data-bs-theme="light"] .article-read-code .token-string {
  color: #0f766e;
}

[data-bs-theme="light"] .article-read-code .token-comment {
  color: #6b7280;
}

[data-bs-theme="light"] .article-read-code .token-number {
  color: #b45309;
}

[data-bs-theme="dark"] .article-read-code .token-keyword {
  color: #c084fc;
}

[data-bs-theme="dark"] .article-read-code .token-string {
  color: #5eead4;
}

[data-bs-theme="dark"] .article-read-code .token-comment {
  color: #94a3b8;
}

[data-bs-theme="dark"] .article-read-code .token-number {
  color: #fbbf24;
}

.article-read-box {
  margin-bottom: 1rem;
}

.article-read-checklist {
  padding: 0.85rem 1rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.article-block-actions {
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease-in-out;
}

.article-block-card:hover .article-block-actions,
.article-block-card:focus-within .article-block-actions {
  opacity: 1;
  pointer-events: auto;
}

.badge .btn-close {
  font-size: 0.6rem;
}

.rich-editor {
  background-color: var(--bs-body-bg);
  overflow: auto;
}

.rich-editor:focus {
  outline: none;
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.editable-node-title,
.editable-article-title {
  cursor: text;
}

.tree-move-handle {
  cursor: grab;
  font-size: 0.9rem;
  line-height: 1;
}

.tree-move-handle:active {
  cursor: grabbing;
}

.tree-node-item {
  transition: box-shadow 120ms ease-in-out, opacity 120ms ease-in-out;
  margin-left: calc(var(--tree-depth, 0) * 1.1rem);
}

.tree-node-title-wrap {
  padding-left: calc(var(--tree-depth, 0) * 0.15rem);
}

.node-tree-shell {
  border-radius: 0.6rem;
}

#projectNodeSections.project-edit-mode .node-tree-shell {
  border: 1px solid var(--bs-border-color);
}

#projectNodeSections:not(.project-edit-mode) .tree-node-item {
  border-left: none !important;
  border-right: none !important;
  border-top: none !important;
  border-bottom: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  margin-left: 0 !important;
}

#projectNodeSections:not(.project-edit-mode) .tree-node-nested {
  border-left: none;
  padding-left: 0;
}

#projectNodeSections:not(.project-edit-mode) .tree-indent-marker {
  display: none;
}

#projectNodeSections:not(.project-edit-mode) .article-list-per-node {
  margin-left: calc((var(--tree-depth, 0) * 1.2rem) + 0.45rem);
  border-left: 2px solid rgba(var(--bs-primary-rgb), 0.14);
  padding-left: 0.5rem;
}

#projectNodeSections:not(.project-edit-mode) .tree-node-title-wrap {
  margin-left: calc(var(--tree-depth, 0) * 1.2rem);
}

.tree-node-nested {
  border-left: 2px solid rgba(var(--bs-primary-rgb), 0.18);
  padding-left: 0.45rem;
}

.tree-indent-marker {
  display: inline-block;
  width: 0.5rem;
  height: 0.95rem;
  margin-right: 0.1rem;
  vertical-align: middle;
  opacity: 0.9;
}

.tree-indent-marker::before {
  content: "";
  display: block;
  width: 0.18rem;
  height: 0.18rem;
  border-radius: 50%;
  background: rgba(var(--bs-primary-rgb), 0.35);
  margin: 0.35rem auto 0;
}

.tree-root-start {
  border-top: 1px solid var(--bs-border-color);
  border-left: 1px solid var(--bs-border-color);
  border-right: 1px solid var(--bs-border-color);
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
  margin-top: 0.4rem;
}

.tree-root-end {
  border-bottom: 1px solid var(--bs-border-color);
  border-left: 1px solid var(--bs-border-color);
  border-right: 1px solid var(--bs-border-color);
  border-bottom-left-radius: 0.5rem;
  border-bottom-right-radius: 0.5rem;
  margin-bottom: 0.35rem;
}

.tree-node-item:not(.tree-root-start):not(.tree-root-end) {
  border-left: 1px solid var(--bs-border-color);
  border-right: 1px solid var(--bs-border-color);
}

.tree-node-item + .tree-node-item {
  border-top: 1px solid rgba(var(--bs-primary-rgb), 0.08);
}

.article-list-per-node {
  min-height: 2.4rem;
}

.article-list-per-node.article-drop-target {
  outline: 2px dashed rgba(var(--bs-primary-rgb), 0.6);
  outline-offset: 2px;
  border-radius: 0.35rem;
  background: rgba(var(--bs-primary-rgb), 0.06);
}

.article-move-handle {
  cursor: grab;
  font-size: 0.9rem;
  line-height: 1;
}

.article-move-handle:active {
  cursor: grabbing;
}

.article-ghost {
  opacity: 0.5;
}

.article-chosen {
  outline: 2px dashed rgba(var(--bs-primary-rgb), 0.55);
}

.node-empty-placeholder {
  pointer-events: none;
}

.tree-node-item.drop-before {
  box-shadow: inset 0 3px 0 var(--bs-primary);
}

.tree-node-item.drop-after {
  box-shadow: inset 0 -3px 0 var(--bs-primary);
}

.tree-node-item.indent-in {
  box-shadow: inset -4px 0 0 var(--bs-success);
}

.tree-node-item.indent-out {
  box-shadow: inset 4px 0 0 var(--bs-warning);
}

.border-dashed {
  border-style: dashed !important;
}

#rootDropZone.drop-active {
  border-color: var(--bs-primary) !important;
  background: rgba(var(--bs-primary-rgb), 0.08);
  color: var(--bs-primary) !important;
}

.tree-node-ghost {
  opacity: 0.45;
}

.tree-node-item.branch-dragged {
  border-left: 3px solid var(--bs-primary);
  padding-left: 0.5rem;
}

.tree-node-item.branch-hidden {
  opacity: 0.35;
}

.branch-children-preview {
  padding-left: 1.4rem;
}

.tree-node-chosen {
  outline: 2px dashed rgba(var(--bs-primary-rgb), 0.55);
}

[contenteditable="true"].editable-node-title,
[contenteditable="true"].editable-article-title {
  outline: 2px solid rgba(13, 110, 253, 0.35);
  border-radius: 0.25rem;
  padding: 0 0.2rem;
  background: rgba(13, 110, 253, 0.08);
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}