.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: var(--radius-md);
  padding: 6px;
  box-shadow: var(--shadow-soft);
  position: relative;
  z-index: 0;
  overflow: visible;
}

.tree {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: visible;
}

.root-drop-zone {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  background: var(--bg);
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.root-drop-zone i {
  font-size: 14px;
}

.root-drop-zone.drop-target {
  background: var(--accent-ghost-strong);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Tree search ─────────────────────────────────────────────────────────── */

.tree-search {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.32rem 0.55rem;
  margin-bottom: 0.4rem;
  transition: border-color 160ms ease;
}

.tree-search:focus-within {
  border-color: var(--accent);
}

.tree-search-icon {
  color: var(--muted);
  font-size: 0.82rem;
  flex-shrink: 0;
}

.tree-search-input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.87rem;
  outline: none;
  min-width: 0;
}

.tree-search-input::placeholder {
  color: var(--muted);
}

.tree-search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.45rem;
  height: 1.45rem;
  flex-shrink: 0;
  border: 0;
  border-radius: var(--radius-sm, 6px);
  background: transparent;
  color: var(--muted);
  padding: 0;
  cursor: pointer;
  font-size: 0.7rem;
  transition: background-color 120ms ease, color 120ms ease;
}

.tree-search-clear:hover {
  background: var(--accent-ghost);
  color: var(--accent);
}

.tree-search-spinner {
  flex-shrink: 0;
  color: var(--accent);
}

.tree-search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  padding: 2.5rem 1rem;
  color: var(--muted);
  text-align: center;
  font-size: 0.87rem;
}

.tree-search-empty i {
  font-size: 1.6rem;
  opacity: 0.45;
}

.tree-search-empty strong {
  color: var(--text);
}

.node-row {
  display: grid;
  grid-template-columns: 20px 22px minmax(0, 1fr) 72px 18px 26px;
  align-items: center;
  column-gap: 8px;
  padding: 7px 10px;
  border-radius: 9px;
  cursor: pointer;
  position: relative;
  transition: background 120ms ease;
  z-index: 1;
}

.node-row:hover {
  background: var(--overlay);
}

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

.node-row.selected::before {
  content: "";
  position: absolute;
  left: 0;
  top: 15%;
  bottom: 15%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

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

.node-row.drop-target {
  background: var(--accent-ghost-strong);
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

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

.node-icon {
  grid-column: 2;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  background: none;
  color: var(--muted);
  font-size: 14px;
}

.node-name {
  grid-column: 3;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-article .node-name,
.node-snippet .node-name {
  font-weight: 500;
}

.node-meta {
  grid-column: 4;
  font-size: 12px;
  color: var(--muted);
  justify-self: start;
  width: 72px;
  white-space: nowrap;
}

.node-toggle {
  grid-column: 1;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: transform 160ms ease;
  position: relative;
  z-index: 2;
}

.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;
  overflow: visible;
}

.node-indent {
  border-left: 1px solid var(--border);
  margin-left: 18px;
  padding-left: 6px;
}

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

.node-row.node-article-draft .node-icon {
  background: none;
  color: var(--muted);
}

.node-row.node-article-draft .node-name {
  color: var(--muted);
}

.node-row.node-article-draft .node-meta {
  color: var(--muted);
}

.node-snippet .node-icon {
  background: none;
  color: var(--accent-warm);
}

.node-snippet .node-name {
  color: var(--text);
}

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

.node-drag-handle {
  grid-column: 5;
  justify-self: center;
  width: 18px;
  height: 22px;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--border-strong);
  cursor: grab;
}

.node-drag-handle:active {
  cursor: grabbing;
}

.node-actions {
  grid-column: 6;
  justify-self: end;
  padding-left: 8px;
  position: relative;
  z-index: 5;
}

.node-drag-placeholder {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 16px;
  display: grid;
  place-items: center;
  font-size: 11px;
}

.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;
  bottom: 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: 60;
  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);
}

.context-menu button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.context-menu-disabled {
  display: block;
}

.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;
}

.content-empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  padding: 22px;
  display: grid;
  gap: 14px;
  justify-items: start;
}

.content-empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-ghost-strong);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 20px;
}

.content-empty-copy strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}

.content-empty-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.content-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

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

/* Normalize Bootstrap mt-3 inside details-card to rely on gap instead */
.details-card .mt-3 {
  margin-top: 0 !important;
}

.details-card .form-label {
  margin-bottom: 5px;
  font-weight: 500;
  color: var(--text);
}

.details-card .form-text {
  margin-top: 4px;
}

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

/* Compact action buttons inside the drawer header */
.drawer-header .btn {
  font-size: 12px;
  padding: 5px 10px;
  line-height: 1.4;
}

.drawer-header .btn-group .dropdown-toggle-split {
  padding-left: 6px;
  padding-right: 6px;
}

/* Compact dropdown menu attached to header buttons */
.drawer-header .dropdown-menu {
  font-size: 12px;
  padding: 4px;
  min-width: 170px;
  border-radius: 10px;
  border-color: var(--border);
  box-shadow: var(--shadow-mid);
  background: var(--card);
  color: var(--text);
}

.drawer-header .dropdown-menu .dropdown-item {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text);
}

.drawer-header .dropdown-menu .dropdown-item:hover,
.drawer-header .dropdown-menu .dropdown-item:focus {
  background: var(--accent-ghost);
  color: var(--accent);
}

.drawer-header .drawer-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

/* Reduce spacing of the status badge in the header */
.drawer-header .mt-2 {
  margin-top: 4px !important;
}

.drawer-header strong {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  display: block;
}

.drawer-header .text-muted.small {
  font-size: 11px;
  line-height: 1.3;
  margin-top: 1px;
}

.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);
}

.status-snippet {
  background: #f3efff;
  color: #5b3dbf;
}

.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: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--border);
  background: transparent;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.drawer-close:hover {
  background: var(--overlay-strong);
  color: var(--text);
  border-color: var(--border-strong);
}

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

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

.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;
}

/* Underline-style tab navigation replacing Bootstrap nav-tabs look */
.editor-tabs.nav.nav-tabs {
  border-bottom: 1px solid var(--border);
  gap: 0;
  flex-wrap: nowrap;
  margin-bottom: 0;
}

.editor-tabs.nav.nav-tabs .nav-link {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  transition: color 120ms ease, border-color 120ms ease;
  margin-bottom: -1px;
}

.editor-tabs.nav.nav-tabs .nav-link:hover {
  color: var(--text);
  background: transparent;
  border-bottom-color: var(--border-strong);
}

.editor-tabs.nav.nav-tabs .nav-link.active {
  color: var(--accent);
  background: transparent;
  border-color: transparent;
  border-bottom-color: var(--accent);
}

.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-body-block {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.editor-text-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.editor-side-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 10px;
}

.editor-side-toggle i {
  font-size: 12px;
}

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

.editor-side .form-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.editor-side .form-select,
.editor-side .form-control {
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 8px;
}

.editor-side .editor-review-date {
  margin-top: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}

/* Compact collection multiselect inside the sidebar */
.editor-side .collection-multiselect-toggle {
  font-size: 12px;
  padding: 5px 8px;
  min-height: 30px;
  border-radius: 8px;
  box-shadow: none;
}

.editor-side .collection-multiselect-menu {
  max-height: 200px;
  padding: 4px;
  border-radius: 8px;
}

.editor-side .collection-multiselect-item {
  min-height: 30px;
  padding: 5px 8px;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 1px;
}

.editor-side .collection-multiselect-item .form-check-input {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

/* Compact ha-toggle inside the sidebar */
.editor-side .ha-toggle-track {
  width: 34px;
  height: 19px;
}

.editor-side .ha-toggle-thumb {
  width: 15px;
  height: 15px;
}

.editor-side .ha-toggle input:checked + .ha-toggle-track .ha-toggle-thumb {
  transform: translateX(15px);
}

.editor-side-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

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

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

/* Publication link — subtle accent row, not a big button */
.editor-pub-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--accent-ghost-strong);
  background: var(--accent-ghost);
  transition: background 120ms ease, border-color 120ms ease;
}

.editor-pub-link i {
  font-size: 12px;
  flex-shrink: 0;
}

.editor-pub-link:hover {
  background: var(--accent-ghost-strong);
  border-color: var(--accent-strong);
  color: var(--accent);
  text-decoration: none;
}

/* Danger zone action — contained but not visually dominant */
.editor-danger-action {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
  color: #dc2626;
  background: transparent;
  border: 1px solid rgba(220, 38, 38, 0.22);
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  transition: background 120ms ease, border-color 120ms ease;
}

.editor-danger-action i {
  font-size: 12px;
  flex-shrink: 0;
}

.editor-danger-action:hover {
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.45);
}

.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-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent-strong);
  color: var(--accent);
}

.editor-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.editor-btn-dropdown {
  width: 36px;
}

.editor-hr-icon {
  font-size: 10px;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.callout-palette-menu {
  min-width: 164px;
}

.table-palette-menu {
  min-width: 250px;
}

.heading-palette-menu {
  min-width: 216px;
}

.heading-palette {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.heading-preview {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  line-height: 1.2;
}

.heading-preview-label {
  display: block;
  font-family: inherit !important;
  line-height: 1.15 !important;
}

.heading-preview-label-h1 {
  font-size: 1.6rem !important;
  font-weight: 800 !important;
}

.heading-preview-label-h2 {
  font-size: 1.35rem !important;
  font-weight: 700 !important;
}

.heading-preview-label-h3 {
  font-size: 1.15rem !important;
  font-weight: 700 !important;
}

.heading-preview-label-h4 {
  font-size: 1rem !important;
  font-weight: 650 !important;
}

.heading-preview-label-h5 {
  font-size: 0.9rem !important;
  font-weight: 600 !important;
}

.heading-preview:hover,
.heading-preview:focus {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
  color: var(--accent);
}

.callout-palette {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.table-palette {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.table-cell-picker {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  width: 34px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.table-cell-picker span {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.table-cell-picker:hover,
.table-cell-picker:focus {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
}

.table-cell-picker.is-active {
  border-color: var(--accent-strong);
  background: #dfe9ff;
}

.callout-swatch {
  width: 68px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  position: relative;
}

.callout-swatch::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 999px;
}

.callout-swatch:hover,
.callout-swatch:focus {
  border-color: var(--accent-strong);
  transform: translateY(-1px);
}

.callout-swatch-blue {
  background: #edf3ff;
}

.callout-swatch-blue::before {
  background: #2f6fed;
}

.callout-swatch-green {
  background: #eaf8ef;
}

.callout-swatch-green::before {
  background: #1f8a4c;
}

.callout-swatch-yellow {
  background: #fff9e8;
}

.callout-swatch-yellow::before {
  background: #b7791f;
}

.callout-swatch-red {
  background: #fff0f0;
}

.callout-swatch-red::before {
  background: #c53030;
}

.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;
  overflow-y: auto;
  overflow-x: auto;
}

.editor-markdown-surface {
  min-height: 0;
  flex: 1;
  height: 100%;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  font-family: "Consolas", "Courier New", monospace;
  resize: none;
  overflow-y: auto;
  overflow-x: auto;
}

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

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

.article-title-input {
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 27px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--text);
  padding: 4px 2px 8px;
}

.article-title-input::placeholder {
  color: var(--muted);
  opacity: 0.95;
}

.article-title-input:focus {
  border-bottom-color: var(--accent-strong);
  background: var(--bg);
  box-shadow: none;
}

.article-intro-input {
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 16px;
  line-height: 1.4;
  color: var(--text);
  padding: 4px 2px 6px;
  min-height: 60px;
  resize: none;
}

.article-intro-input::placeholder {
  color: var(--muted);
  opacity: 0.95;
}

.article-intro-input:focus {
  border-bottom-color: var(--accent-strong);
  background: var(--bg);
  box-shadow: none;
}

.editor-review-date {
  margin-top: 8px;
}

.collection-multiselect {
  width: 100%;
  position: relative;
  z-index: 15;
}

.collection-multiselect-toggle {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  padding: 6px 10px;
  box-shadow: var(--shadow-soft);
}

.collection-multiselect-toggle:hover,
.collection-multiselect-toggle:focus {
  border-color: var(--accent);
  background: var(--card);
  color: var(--text);
}

.collection-multiselect-menu {
  width: 100%;
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--shadow-mid);
  z-index: 20;
}

.collection-multiselect-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 10px;
  margin-bottom: 4px;
  border-radius: 8px;
  white-space: normal;
  cursor: pointer;
}

.collection-multiselect-item:last-child {
  margin-bottom: 0;
}

.collection-multiselect-item:hover {
  background: var(--accent-ghost);
}

.collection-multiselect-item .form-check-input {
  margin: 0;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.collection-multiselect-item .form-check-label {
  line-height: 1.25;
}

.collection-multiselect-backdrop {
  position: fixed;
  inset: 0;
  border: 0;
  background: transparent;
  z-index: 10;
  padding: 0;
}

.form-label.form-label-subtle {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.review-date-input {
  max-width: 190px;
}

.editor-ai-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.editor-ai-toggle-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.editor-ai-toggle-control {
  flex-shrink: 0;
}

.autosave-restore-footer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.autosave-restore-footer .btn {
  width: 100%;
  min-width: 0;
  white-space: normal;
  word-break: break-word;
  line-height: 1.15;
  text-align: center;
  min-height: 36px;
  font-size: 12px;
  padding-left: 10px;
  padding-right: 10px;
}

.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-surface h3 {
  font-size: 18px;
  margin: 12px 0 8px;
}

.editor-surface h4 {
  font-size: 16px;
  margin: 10px 0 8px;
}

.editor-surface h5 {
  font-size: 14px;
  margin: 10px 0 8px;
}

.editor-surface hr {
  border: 0;
  border-top: 2px solid var(--border);
  margin: 14px 0;
}

.editor-surface table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.editor-surface table th,
.editor-surface table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  vertical-align: top;
  min-width: 90px;
}

.editor-surface table th {
  background: #edf3ff;
  font-weight: 700;
}

.editor-surface blockquote.kb-editor-callout {
  margin: 12px 0;
  padding: 10px 14px;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.editor-surface blockquote.kb-editor-callout .callout-marker {
  display: none;
}

.editor-surface blockquote.kb-editor-callout p {
  margin: 0 0 6px;
}

.editor-surface blockquote.kb-editor-callout p:last-child {
  margin-bottom: 0;
}

.editor-surface blockquote.kb-editor-callout-blue {
  border-left-color: #2f6fed;
  background: #edf3ff;
}

.editor-surface blockquote.kb-editor-callout-green {
  border-left-color: #1f8a4c;
  background: #eaf8ef;
}

.editor-surface blockquote.kb-editor-callout-yellow {
  border-left-color: #b7791f;
  background: #fff9e8;
}

.editor-surface blockquote.kb-editor-callout-red {
  border-left-color: #c53030;
  background: #fff0f0;
}

.editor-surface .kb-editor-image-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
  margin: 8px 0;
  border-radius: 6px;
  outline: 1px dashed transparent;
}

.editor-surface .kb-editor-image-wrap img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.editor-surface .kb-editor-image-wrap:hover {
  outline-color: rgba(47, 111, 237, 0.35);
}

.editor-surface .kb-editor-image-wrap.is-selected {
  outline-color: rgba(47, 111, 237, 0.55);
}

.editor-surface .kb-editor-image-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #2f6fed;
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(47, 111, 237, 0.35);
  display: none;
}

.editor-surface .kb-editor-image-wrap.is-selected .kb-editor-image-handle {
  display: block;
}

.editor-surface .kb-editor-image-details-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  border: 1px solid rgba(47, 111, 237, 0.35);
  background: rgba(255, 255, 255, 0.94);
  color: #1f4db7;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  padding: 5px 10px;
  box-shadow: var(--shadow-soft);
  display: none;
}

.editor-surface .kb-editor-image-wrap.is-selected .kb-editor-image-details-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.editor-surface .kb-editor-image-handle-nw {
  left: -5px;
  top: -5px;
  cursor: nwse-resize;
}

.editor-surface .kb-editor-image-handle-ne {
  right: -5px;
  top: -5px;
  cursor: nesw-resize;
}

.editor-surface .kb-editor-image-handle-sw {
  left: -5px;
  bottom: -5px;
  cursor: nesw-resize;
}

.editor-surface .kb-editor-image-handle-se {
  right: -5px;
  bottom: -5px;
  cursor: nwse-resize;
}

.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%;
}

.editor-image-dropzone {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 14px;
  background: var(--bg);
  transition: border-color 140ms ease, background 140ms ease;
}

.editor-image-dropzone.is-dragover {
  border-color: var(--accent-strong);
  background: var(--accent-ghost-strong);
}

.editor-image-preview {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  background: var(--bg);
  max-height: 220px;
  overflow: auto;
}

.editor-image-preview img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

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

  .editor-side-toggle {
    display: inline-flex;
    align-self: flex-start;
  }

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

  .editor-details {
    height: auto;
  }

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

  .editor-side {
    position: static;
    top: auto;
    height: auto;
  }

  .editor-side.is-collapsed {
    display: none;
  }

  .editor-main .editor-shell {
    min-height: min(62vh, 620px);
  }

  .article-title-input {
    font-size: 24px;
  }

  .article-intro-input {
    font-size: 15px;
    min-height: 52px;
  }
}

@media (max-width: 768px) {
  .content-page {
    gap: 14px;
  }

  .content-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .content-header .d-flex {
    width: 100%;
    justify-content: flex-end;
    gap: 6px !important;
  }

  .content-header .btn {
    padding: 6px 10px;
    font-size: 13px;
    line-height: 1.2;
    border-radius: 10px;
  }

  .content-header .btn-with-icon {
    gap: 5px;
  }

  .tree-shell {
    padding: 4px;
  }

  .content-empty-actions {
    width: 100%;
    flex-direction: column;
  }

  .content-empty-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .editor-side-toggle {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .content-header .d-flex {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .content-header .btn {
    padding: 6px 9px;
    font-size: 12px;
  }
}
