.content-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.content-title h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.content-title p {
  margin: 0;
  color: var(--muted);
}

.tree-shell {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow-mid);
  position: relative;
  z-index: 0;
}

.tree {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.node-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  position: relative;
  transition: background 160ms ease, transform 160ms ease;
  z-index: 1;
}

.node-row:hover {
  background: var(--accent-ghost);
  transform: translateY(-1px);
}

.node-row.selected {
  background: var(--accent-ghost-strong);
}

.node-row.context-open {
  z-index: 6;
  transform: none;
}

.node-row button {
  border: 0;
  background: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.node-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--accent-ghost-strong);
  color: var(--btn);
  font-size: 16px;
}

.node-name {
  font-weight: 600;
}

.node-meta {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
}

.node-toggle {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: transform 160ms ease;
}

.node-toggle.open {
  transform: rotate(90deg);
}

.node-children {
  max-height: 0;
  overflow: hidden;
  transition: max-height 240ms ease, opacity 200ms ease;
  opacity: 0;
}

.node-children.expanded {
  max-height: 1000px;
  opacity: 1;
}

.node-indent {
  border-left: 1px dashed var(--accent-ghost-strong);
  margin-left: 14px;
  padding-left: 10px;
}

.node-article .node-icon {
  background: var(--accent-sky-soft);
  color: var(--accent-sky);
}

.node-folder .node-icon {
  background: var(--accent-ghost-strong);
  color: var(--accent);
}

.node-actions {
  margin-left: auto;
  padding-left: 8px;
  position: relative;
  z-index: 5;
}

.node-action-button {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.node-action-button:hover {
  background: var(--accent-ghost);
}

.context-menu {
  position: absolute;
  right: 0;
  top: 34px;
  min-width: 180px;
  max-width: 240px;
  width: fit-content;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  box-shadow: var(--shadow-float);
  z-index: 25;
  pointer-events: auto;
}

.context-menu button {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.context-menu button:hover {
  background: var(--accent-ghost);
}

.content-backdrop {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 4;
  pointer-events: auto;
}

.loading-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 46px;
  color: var(--muted);
  font-size: 13px;
}

.loading-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: block;
  background: var(--accent);
  animation: pulse 1.4s infinite;
}

.details-card {
  background: var(--bg);
  border-radius: 12px;
  padding: 14px;
  color: var(--muted);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: inset 0 1px 0 var(--highlight);
}

.details-card strong {
  color: var(--text);
  font-size: 15px;
}

.drawer-header {
  position: sticky;
  top: 0;
  background: var(--card);
  padding: 12px 6px 12px 6px;
  margin: -18px -14px 12px -14px;
  border-bottom: 1px solid var(--border);
  z-index: 2;
  backdrop-filter: blur(8px);
}

.status-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.status-draft {
  background: var(--accent-gold-soft);
  color: var(--accent-gold);
}

.status-published {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-accent {
  background: var(--action);
  color: #fff;
  border: 1px solid var(--action);
  box-shadow: 0 10px 20px var(--action-glow);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.btn-accent:hover,
.btn-accent:focus {
  background: var(--action-strong);
  border-color: var(--action-strong);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 12px 28px var(--action-glow);
}

.btn-accent.dropdown-toggle::after {
  margin-left: 0.35rem;
}

.btn-accent-outline {
  background: var(--action-ghost);
  color: var(--action);
  border: 1px solid rgba(15, 118, 110, 0.28);
  box-shadow: none;
}

.btn-accent-outline:hover,
.btn-accent-outline:focus {
  background: var(--action);
  border-color: var(--action);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 10px 20px var(--action-glow);
}

.drawer-close {
  width: 40px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--action);
  border: 1px solid rgba(15, 118, 110, 0.28);
  background: var(--action-ghost);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease;
}

.drawer-close:hover {
  background: var(--action);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 10px 20px var(--action-glow);
}

.tree-shell,
.details-card,
.context-menu {
  border-radius: var(--radius-lg);
}

.node-row,
.article-item,
.drawer-close,
.btn-accent {
  border-radius: var(--radius-sm);
}

.node-icon,
.activity-icon {
  border-radius: var(--radius-sm);
}

.editor-shell {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-soft);
  width: 100%;
  flex: 1;
  min-height: 0;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 18px;
  align-items: stretch;
  height: var(--editor-height);
}

.editor-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.editor-side {
  position: sticky;
  top: 90px;
  align-self: stretch;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
  overflow-y: auto;
}

.editor-side .form-label {
  font-weight: 600;
  color: var(--text);
}

.editor-side-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--accent-ghost-strong);
}

.editor-side-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.editor-side-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 8px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toolbar-divider {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 4px;
}

.editor-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  display: grid;
  place-items: center;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.editor-btn:hover,
.editor-btn:focus {
  background: var(--accent-soft);
  border-color: var(--accent-strong);
  color: var(--accent);
  transform: translateY(-1px);
}

.editor-surface {
  min-height: 320px;
  flex: 1;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

.intro-field {
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border-color: var(--border);
}

.intro-field:focus {
  background: var(--card);
}

.editor-surface:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-ghost-strong);
  border-color: var(--accent-strong);
}

.editor-surface:empty:before {
  content: attr(data-placeholder);
  color: var(--muted);
}

.editor-surface h1 {
  font-size: 24px;
  margin: 0 0 8px;
}

.editor-surface h2 {
  font-size: 20px;
  margin: 14px 0 8px;
}

.editor-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.editor-language-select {
  height: 30px;
  padding: 0 28px 0 10px;
  font-size: 12px;
  border-radius: 999px;
  border-color: var(--accent-strong);
  background-color: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}
.editor-toolbar .btn-light {
  background: var(--surface);
  border-color: transparent;
}

.editor-toolbar .btn-light:hover {
  background: var(--accent-ghost-strong);
}

.editor-tip {
  font-size: 12px;
  color: var(--muted);
}

.editor-details {
  --editor-height: calc(100vh - 220px);
  padding: 0;
  background: transparent;
  box-shadow: none;
  height: var(--editor-height);
}

.editor-details .editor-layout {
  height: var(--editor-height);
}

.editor-details .editor-shell {
  height: 100%;
}

@media (max-width: 1100px) {
  .editor-layout {
    grid-template-columns: 1fr;
    min-height: auto;
    height: auto;
  }

  .editor-details .editor-layout {
    min-height: auto;
  }

  .editor-details {
    height: auto;
  }

  .editor-side {
    overflow-y: visible;
  }

  .editor-side {
    position: static;
  }
}
