.tree-item { transition: all 0.2s ease; }
.tree-item .article-drag-handle {
  cursor: grab;
  color: #9ca3af;
  padding: 4px;
  border-radius: 4px;
}
.tree-item .article-drag-handle:active {
  cursor: grabbing;
}
.tree-item .article-drag-handle:hover {
  color: #6366f1;
  background: #eef2ff;
}
.tree-item.article-dragging {
  opacity: 0.4;
  background: #eef2ff;
}
.tree-item.article-drag-over {
  border: 2px dashed #4f46e5;
  background: #f5f3ff;
}
.tree-children { margin-left: 1.5rem; }
.notification { animation: slideIn 0.3s ease; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.sidebar-item.active { background: #dcfce7; border-left: 3px solid #1A9119; }

.loading-spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid #4f46e5;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.part-btn {
  transition: all 0.2s;
  cursor: grab;
}

.part-btn:active {
  cursor: grabbing;
}

.part-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.preview-part {
  position: relative;
  border: 2px solid transparent;
  border-radius: 4px;
  transition: border-color 0.2s;
}

.preview-part:hover {
  border-color: #4f46e5;
}

.preview-part .drag-handle {
  cursor: grab;
  color: #9ca3af;
  display: none;
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 10;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.preview-part .drag-handle:active {
  cursor: grabbing;
}

.preview-part:hover .drag-handle {
  display: flex;
}

.preview-part.dragging {
  opacity: 0.4;
  border-color: #a5b4fc;
  background: #eef2ff;
}

.preview-part.drag-over-top::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 0;
  right: 0;
  height: 4px;
  background: #4f46e5;
  border-radius: 2px;
  z-index: 20;
}

.preview-part.drag-over-bottom::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  right: 0;
  height: 4px;
  background: #4f46e5;
  border-radius: 2px;
  z-index: 20;
}

.preview-part.drag-over-top::before,
.preview-part.drag-over-bottom::after {
  box-shadow: 0 0 6px rgba(79, 70, 229, 0.5);
}

#preview-container.drag-over-empty {
  border: 2px dashed #4f46e5;
  background: #f5f3ff;
}

.drop-indicator-end {
  height: 4px;
  background: #4f46e5;
  border-radius: 2px;
  margin-top: 4px;
  box-shadow: 0 0 6px rgba(79, 70, 229, 0.5);
  display: none;
}

.drop-indicator-end.visible {
  display: block;
}

.preview-part .part-actions {
  display: none;
  position: absolute;
  top: 4px;
  right: 4px;
  gap: 4px;
  z-index: 10;
}

.preview-part:hover .part-actions {
  display: flex;
}

.article-preview {
  font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
  line-height: 1.7;
  color: #343a40;
  background: #fff;
  padding: 15px 20px;
}

.article-preview .main-title {
  color: #fff;
  padding: 4px 20px;
  font-size: 1.4em;
  font-weight: 700;
  margin: 20px 0;
  border-radius: 0;
}

.main-title.green { background: #39a17d; }
.main-title.blue { background: #1976d2; }
.main-title.purple { background: #8e44ad; }
.main-title.red { background: #dc3545; }
.main-title.orange { background: #ff9800; }
.main-title.gray { background: #6c757d; }

.article-preview .section-header {
  font-size: 1.35em;
  margin: 24px 0 16px;
  padding: 8px 0 8px 14px;
  position: relative;
  font-weight: 600;
  line-height: 1.4;
  color: #1f2937;
  border-left: 4px solid #22c55e;
}

.section-header.green { border-left-color: #22c55e; }
.section-header.blue { border-left-color: #3b82f6; }
.section-header.yellow { border-left-color: #eab308; }
.section-header.red { border-left-color: #ef4444; }
.section-header.purple { border-left-color: #a855f7; }


.article-preview .text-content {
  font-size: 1em;
  line-height: 1.7;
  margin: 10px 0 20px;
}

.article-preview .code-block {
  background: #1f2933;
  color: #f8f9fa;
  border-radius: 8px;
  overflow: hidden;
  margin: 15px 0;
}

.code-block-summary {
  background: rgba(148, 163, 184, 0.12);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85em;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.9);
}

.code-block-body pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.9em;
  line-height: 1.65;
}

.article-preview .important-content {
  background: #fffbeb;
  border: 1px solid #ffe58f;
  padding: 15px 20px;
  border-radius: 4px;
  margin: 15px 0;
}

.important-content ul {
  list-style: none;
  padding-left: 5px;
  margin: 0;
}

.important-content li {
  margin-bottom: 0.6em;
  padding-left: 20px;
  position: relative;
  font-size: 0.95em;
  color: #664d03;
}

.important-content li::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 0.6em;
  width: 6px;
  height: 6px;
  background: #ffc107;
  border-radius: 50%;
}

.article-preview .faq-item {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 15px 20px;
  margin: 15px 0;
}

.faq-question {
  font-weight: 600;
  color: #2c6e49;
  font-size: 1.05em;
  margin-bottom: 10px;
  padding-left: 38px;
  position: relative;
}

.faq-question::before {
  content: 'Q';
  position: absolute;
  left: 0;
  top: 0;
  background: #4caf50;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9em;
  font-weight: 700;
}

.faq-answer {
  color: #495057;
  font-size: 0.98em;
  padding-left: 38px;
  position: relative;
}

.faq-answer::before {
  content: 'A';
  position: absolute;
  left: 0;
  top: 0;
  background: #ff9800;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9em;
  font-weight: 700;
}

.article-preview .divider {
  border: none;
  border-top: 1px solid #e9ecef;
  margin: 20px 0;
}

.article-preview .glossary-table {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0;
  font-size: 0.95em;
  border: 1px solid #ccc;
}

.glossary-table th,
.glossary-table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

.glossary-table th {
  background: #f0f9f4;
  color: #155724;
  font-weight: 600;
  width: 25%;
  border-right: 1px solid #ccc;
}

.glossary-table td {
  background: #fff;
}

.article-preview .fancy-divider {
  height: 40px;
  width: 100%;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  margin: 10px auto;
}

.fancy-divider.green { background-image: url('https://expt-pic.imgix.net/site_f_svg/v1/separator/fade_triangle/39a17d'); }
.fancy-divider.blue { background-image: url('https://expt-pic.imgix.net/site_f_svg/v1/separator/fade_triangle/1976d2'); }
.fancy-divider.orange { background-image: url('https://expt-pic.imgix.net/site_f_svg/v1/separator/fade_triangle/ff9800'); }
.fancy-divider.purple { background-image: url('https://expt-pic.imgix.net/site_f_svg/v1/separator/fade_triangle/9c27b0'); }
.fancy-divider.red { background-image: url('https://expt-pic.imgix.net/site_f_svg/v1/separator/fade_triangle/dc3545'); }

.article-preview .button-link {
  background: #00b16a;
  color: #fff !important;
  text-decoration: none !important;
  padding: 6px 16px;
  border-radius: 4px;
  font-weight: 700;
  display: inline-block;
}

.button-link.green { background: #00b16a; }
.button-link.blue { background: #0d6efd; }
.button-link.orange { background: #fd7e14; }
.button-link.red { background: #dc3545; }
.button-link.gray { background: #6c757d; }

.article-preview .step-box {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin: 20px 0;
  padding: 8px;
  overflow: hidden;
}

.step-box h3 {
  background: #fff;
  padding: 15px 20px 10px;
  font-size: 1.2em;
  font-weight: 700;
  border-bottom: 2px dashed;
  margin: 10px 20px 20px;
}

.step-box.green h3 { color: #3cb371; border-color: #3cb371; }
.step-box.blue h3 { color: #1976d2; border-color: #1976d2; }
.step-box.orange h3 { color: #ff9800; border-color: #ff9800; }

.step-box .step-content {
  padding: 15px 25px 25px;
  font-size: 0.95em;
}

.article-preview .content-box {
  background: #f2fdf9;
  border: 1px solid #bde0d5;
  padding: 20px;
  border-radius: 6px;
  margin: 20px 0;
}

.content-box.gray { background: #f5f5f5; border-color: #ddd; }
.content-box.orange { background: #fff3e0; border-color: #ffcc80; }
.content-box.blue { background: #e3f2fd; border-color: #90caf9; }
.content-box.red { background: #ffebee; border-color: #ffcdd2; }

.article-preview .image-block {
  margin: 20px 0;
  text-align: center;
}

.image-block.left { text-align: left; }
.image-block.right { text-align: right; }
.image-block img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.image-upload-area {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.image-upload-area:hover {
  border-color: #4f46e5;
  background: #f5f3ff;
}

.image-upload-area.dragover {
  border-color: #4f46e5;
  background: #eef2ff;
}

.image-preview-thumb {
  max-width: 100%;
  max-height: 200px;
  border-radius: 4px;
  margin-top: 10px;
}

.child-links-list {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px 20px;
  margin: 20px 0;
}

.child-links-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.child-links-list li {
  padding: 8px 0;
  border-bottom: 1px solid #e2e8f0;
}

.child-links-list li:last-child {
  border-bottom: none;
}

.child-links-list a {
  color: #1A66D1;
  text-decoration: none;
  font-weight: 500;
}

.child-links-list a:hover {
  text-decoration: underline;
}

.child-links-list ul ul {
  margin-left: 1.25rem;
  padding: 0;
}

.child-links-list ul ul li:first-child {
  padding-top: 8px;
}

.step-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1em;
  font-weight: 600;
  margin: 20px 0 10px;
  color: #1f2937;
}

.step-heading .step-number {
  color: #22c55e;
  font-weight: 700;
  font-size: 0.95em;
}

.step-heading.green .step-number { color: #22c55e; }
.step-heading.blue .step-number { color: #3b82f6; }
.step-heading.orange .step-number { color: #f97316; }
.step-heading.red .step-number { color: #ef4444; }
.step-heading.purple .step-number { color: #a855f7; }
.step-heading.gray .step-number { color: #6b7280; }

.image-block.size-small img {
  max-width: 33%;
}

.image-block.size-medium img {
  max-width: 66%;
}

.image-block.size-large img {
  max-width: 100%;
}

.image-block.with-border img {
  border: 1px solid #d1d5db;
  border-radius: 4px;
}

.spacer-block {
  width: 100%;
  background: transparent;
}

.preview-part .spacer-block {
  background: repeating-linear-gradient(
    45deg,
    #f0f0f0,
    #f0f0f0 10px,
    #e0e0e0 10px,
    #e0e0e0 20px
  );
  border: 1px dashed #ccc;
  position: relative;
}

.preview-part .spacer-block::after {
  content: attr(data-height) 'px';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: #666;
}

#part-text-editor {
  line-height: 1.6;
  overflow-y: auto;
  max-height: 300px;
}

#part-text-editor:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

#part-text-editor a {
  color: #2563eb;
  text-decoration: underline;
}

.rich-editor-toolbar select {
  cursor: pointer;
}

.rich-editor-toolbar button:active {
  background: #e5e7eb;
}

.text-content a {
  color: #2563eb;
  text-decoration: underline;
}

.text-content a:hover {
  text-decoration: none;
}

.content-box a {
  color: #2563eb;
  text-decoration: underline;
}

.content-box a:hover {
  text-decoration: none;
  opacity: 0.8;
}

/* ── 汎用テーブルUI ── */
.article-preview .data-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 15px 0;
}

.article-preview .data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
  border: 1px solid #d1d5db;
}

.article-preview .data-table thead th {
  background: #f0f4f8;
  color: #1f2937;
  font-weight: 600;
  padding: 11px 14px;
  text-align: left;
  border: 1px solid #d1d5db;
  white-space: nowrap;
}

.article-preview .data-table tbody td {
  padding: 11px 14px;
  text-align: left;
  border: 1px solid #e5e7eb;
  background: #fff;
  vertical-align: top;
}

.article-preview .data-table tbody tr:nth-child(even) td {
  background: #f9fafb;
}

.article-preview .data-table tbody tr:hover td {
  background: #f0f9ff;
}

/* テーブル・テキスト内インラインコード */
.article-preview .data-table code,
.article-preview .text-content code {
  background: #f1f5f9;
  color: #e11d48;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.88em;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}

/* レスポンシブ: カード型スタック表示 */
@media (max-width: 640px) {
  .article-preview .data-table {
    border: none;
  }

  .article-preview .data-table thead {
    display: none;
  }

  .article-preview .data-table tbody tr {
    display: block;
    margin-bottom: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
  }

  .article-preview .data-table tbody td {
    display: block;
    padding: 8px 14px;
    border: none;
    border-bottom: 1px solid #f0f0f0;
  }

  .article-preview .data-table tbody td::before {
    content: attr(data-label);
    display: block;
    font-weight: 600;
    font-size: 0.8em;
    color: #6b7280;
    margin-bottom: 2px;
  }

  .article-preview .data-table tbody td:last-child {
    border-bottom: none;
  }

  .article-preview .data-table tbody tr:nth-child(even) td {
    background: #fff;
  }
}

.toc-block {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px 20px;
  margin: 20px 0;
}

.toc-block .toc-title {
  font-weight: 600;
  color: #374151;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

.toc-block .toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-block .toc-list li {
  padding: 6px 0;
}

.toc-block .toc-list a {
  color: #1A66D1;
  text-decoration: none;
}

.toc-block .toc-list a:hover {
  text-decoration: underline;
}

.toc-block .toc-placeholder {
  color: #666;
  font-style: italic;
  margin: 0;
}

.labeled-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 16px;
}

.labeled-heading .lh-label {
  display: inline-block;
  font-size: 0.8em;
  font-weight: 700;
  padding: 2px 12px;
  border-radius: 4px;
  white-space: nowrap;
  line-height: 1.6;
}

.labeled-heading .lh-text {
  font-weight: 600;
  color: #1f2937;
  line-height: 1.4;
}

.labeled-heading.lh-h2 .lh-text { font-size: 1.35em; }
.labeled-heading.lh-h3 .lh-text { font-size: 1.15em; }

/* variant: primary */
.labeled-heading.lh-primary .lh-label { background: #22c55e; color: #fff; }
.labeled-heading.lh-primary.blue .lh-label { background: #3b82f6; }
.labeled-heading.lh-primary.orange .lh-label { background: #f97316; }
.labeled-heading.lh-primary.red .lh-label { background: #ef4444; }
.labeled-heading.lh-primary.purple .lh-label { background: #a855f7; }
.labeled-heading.lh-primary.gray .lh-label { background: #6b7280; }

/* variant: accent */
.labeled-heading.lh-accent .lh-label { background: #dcfce7; color: #166534; }
.labeled-heading.lh-accent.blue .lh-label { background: #dbeafe; color: #1e40af; }
.labeled-heading.lh-accent.orange .lh-label { background: #ffedd5; color: #9a3412; }
.labeled-heading.lh-accent.red .lh-label { background: #fee2e2; color: #991b1b; }
.labeled-heading.lh-accent.purple .lh-label { background: #f3e8ff; color: #6b21a8; }
.labeled-heading.lh-accent.gray .lh-label { background: #f3f4f6; color: #374151; }

/* variant: outlined */
.labeled-heading.lh-outlined .lh-label { background: transparent; border: 2px solid #22c55e; color: #166534; }
.labeled-heading.lh-outlined.blue .lh-label { border-color: #3b82f6; color: #1e40af; }
.labeled-heading.lh-outlined.orange .lh-label { border-color: #f97316; color: #9a3412; }
.labeled-heading.lh-outlined.red .lh-label { border-color: #ef4444; color: #991b1b; }
.labeled-heading.lh-outlined.purple .lh-label { border-color: #a855f7; color: #6b21a8; }
.labeled-heading.lh-outlined.gray .lh-label { border-color: #6b7280; color: #374151; }

.quill-editor-container {
  background: #fff;
  border-radius: 4px;
}

.quill-editor-container .ql-toolbar {
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  background: #f9fafb;
}

.quill-editor-container .ql-container {
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
  min-height: 120px;
  font-size: 14px;
}

.quill-editor-container .ql-editor {
  min-height: 120px;
}

.ql-snow .ql-picker.ql-size .ql-picker-label::before,
.ql-snow .ql-picker.ql-size .ql-picker-item::before {
  content: '標準';
}

.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="small"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="small"]::before {
  content: '小';
}

.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="large"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="large"]::before {
  content: '大';
}

.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="huge"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="huge"]::before {
  content: '特大';
}
/* Quillエディタ内のサイズ */
.ql-editor .ql-size-small {
  font-size: 0.75em;
}

.ql-editor .ql-size-large {
  font-size: 1.5em;
}

.ql-editor .ql-size-huge {
  font-size: 2em;
}

/* プレビュー・公開画面でのサイズ */
.article-preview .ql-size-small,
.text-content .ql-size-small {
  font-size: 0.75em;
}

.article-preview .ql-size-large,
.text-content .ql-size-large {
  font-size: 1.5em;
}

.article-preview .ql-size-huge,
.text-content .ql-size-huge {
  font-size: 2em;
}

/* FAQ回答内のサイズ */
.faq-answer .ql-size-small {
  font-size: 0.75em;
}

.faq-answer .ql-size-large {
  font-size: 1.5em;
}

.faq-answer .ql-size-huge {
  font-size: 2em;
}

/* 囲みテキスト内のサイズ */
.content-box .ql-size-small {
  font-size: 0.75em;
}

.content-box .ql-size-large {
  font-size: 1.5em;
}

.content-box .ql-size-huge {
  font-size: 2em;
}