* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Helvetica Neue", Arial, sans-serif;
  background: #f4f6f8;
  color: #333;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

#app {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ============================================================
   左カラム: チーム・カテゴリ・JSON
   ============================================================ */
#left-column {
  flex: 0 0 220px;
  background: #fff;
  border-right: 1px solid #dde1e7;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.col-section {
  flex-shrink: 0;
  border-bottom: 1px solid #dde1e7;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* チームセクションは伸縮させる */
#left-column .col-section:first-child {
  flex: 0 0 auto;
  max-height: 45%;
}

#left-column #category-section {
  flex: 1;
  min-height: 0;
}

.col-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  flex-shrink: 0;
  border-bottom: 1px solid #eee;
}

.col-section-title {
  font-size: 12px;
  font-weight: bold;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: 1px solid #4a90d9;
  border-radius: 4px;
  background: #fff;
  color: #4a90d9;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.btn-icon:hover {
  background: #4a90d9;
  color: #fff;
}

#team-list,
#category-list {
  overflow-y: auto;
  flex: 1;
}

/* 共通リスト行 */
.list-row {
  display: flex;
  align-items: center;
  border-left: 3px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  cursor: default;
}

.list-row:hover {
  background: #f0f4fa;
}

.list-row.active {
  background: #eaf2ff;
  border-left-color: #4a90d9;
}

.list-row.active .row-name {
  font-weight: bold;
  color: #2c6db5;
}

.row-name {
  flex: 1;
  padding: 9px 6px 9px 10px;
  font-size: 14px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-actions {
  display: none;
  gap: 4px;
  padding-right: 6px;
  flex-shrink: 0;
}

.list-row:hover .row-actions,
.list-row.active .row-actions {
  display: flex;
}


/* ============================================================
   中央カラム: ノード一覧 + 編集パネル
   ============================================================ */
#center-column {
  flex: 0 0 340px;
  background: #f9fafb;
  border-right: 1px solid #dde1e7;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.center-header {
  background: #fff;
  border-bottom: 1px solid #dde1e7;
  padding: 10px 14px;
  flex-shrink: 0;
}

#node-list-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  border-bottom: 1px solid #dde1e7;
  background: rgba(100, 180, 255, 0.08); /* [DIAG] エリア自体を薄青で可視化 */
  outline: 2px solid #4a90d9;            /* [DIAG] エリア境界を青枠で確認 */
}

/* 編集パネル開時: センターカラム高さの35%まで（ビューポート比例） */
#center-column.has-edit #node-list-area {
  flex: 0 0 auto;
  max-height: 35%;
  min-height: 80px;
}

#node-list {
  padding: 4px 0;
  min-height: 100%;
}

/* ノード行 */
.node-row {
  display: block;
  min-height: 40px;
  padding: 2px 0;
}

.node-row.editing {
  background: #fff3cd;
  border-left-color: #f5a623 !important;
  border-left-width: 4px !important;
}

.node-row.previewing {
  background: #eaf2ff;
  border-left-color: #4a90d9 !important;
}

.node-row-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 6px 8px 10px;
  min-width: 0;
  cursor: default;
}

.node-row-title {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-badges {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.badge {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: bold;
}

.badge-root {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.badge-end {
  background: #fce4ec;
  color: #c62828;
  border: 1px solid #f48fb1;
}

.badge-editing {
  background: #fff0cc;
  color: #b07800;
  border: 1px solid #f5a623;
}

.badge-locked {
  background: #fce8e8;
  color: #c0392b;
  border: 1px solid #e57373;
}

/* 編集パネル */
#edit-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: #fff;
  border-top: 2px solid #f5a623;
}

.edit-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #fffbf0;
  border-bottom: 1px solid #f0e0b0;
  flex-shrink: 0;
}

.edit-panel-title {
  font-size: 13px;
  font-weight: bold;
  color: #7a6000;
}

#edit-form {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-label {
  font-size: 12px;
  font-weight: bold;
  color: #666;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.form-row-inline {
  flex-direction: row;
  align-items: center;
}

.form-label-inline {
  font-size: 13px;
  color: #444;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.form-input,
.form-select {
  padding: 7px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus,
.form-select:focus {
  border-color: #4a90d9;
}

.form-textarea {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  outline: none;
  resize: vertical;
  line-height: 1.6;
  transition: border-color 0.15s;
}

.form-textarea:focus {
  border-color: #4a90d9;
}

.root-row {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.list-empty-hint {
  padding: 14px 12px;
  font-size: 12px;
  color: #bbb;
  text-align: center;
  line-height: 1.6;
}

.root-badge {
  font-size: 11px;
  color: #2e7d32;
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: 3px;
  padding: 2px 6px;
}

/* 画像エリア */
#edit-image-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.edit-image-preview {
  max-width: 100%;
  max-height: 120px;
  border-radius: 6px;
  border: 1px solid #dde1e7;
  object-fit: contain;
}

.image-btns {
  display: flex;
  gap: 6px;
}

.image-size-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.image-size-label {
  font-size: 11px;
  color: #666;
  flex-shrink: 0;
}

.image-scale-controls {
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-scale {
  width: 28px;
  height: 28px;
  border: 1px solid #ccc;
  border-radius: 5px;
  background: #f5f7fa;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
}

.btn-scale:hover { background: #e4e8f0; border-color: #aaa; }
.btn-scale:active { background: #d8dde8; }

.image-scale-display {
  min-width: 46px;
  text-align: center;
  font-size: 13px;
  font-weight: bold;
  color: #333;
}

.btn-scale-reset {
  font-size: 11px;
  padding: 0 8px;
  border: 1px solid #ccc;
  border-radius: 5px;
  background: #f5f7fa;
  cursor: pointer;
  color: #666;
  height: 28px;
  flex-shrink: 0;
}

.btn-scale-reset:hover { background: #e4e8f0; }

/* 選択肢 */
.options-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

#options-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.option-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.option-main {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
}

.option-style-panel {
  background: #f8f9fa;
  border: 1px solid #e0e4ea;
  border-radius: 4px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.opt-toggle-btn,
.opt-del-btn {
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.opt-toggle-btn {
  color: #4a90d9;
  border-color: #4a90d9;
}

.opt-del-btn {
  flex: 0 0 56px;
  width: 56px;
  min-width: 56px;
  max-width: 56px;
  padding: 0;
}

.opt-toggle-btn.open {
  background: #eaf2ff;
}

.option-label-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.form-select {
  flex: 1;
  min-width: 0;
}

/* opt-col 内の select は縦方向コンテナなので flex を解除して横幅で制御 */
.opt-col .form-select {
  flex: none;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* 選択肢フィールド列（ラベル・遷移先それぞれ） */
.opt-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.opt-col-label {
  display: block;
  white-space: nowrap;
  font-size: 10px;
  color: #aaa;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
}

/* 未保存インジケーター */
.unsaved-indicator {
  font-size: 12px;
  color: #e67e22;
  font-weight: bold;
  padding: 4px 0 2px;
}

/* 編集ステータスメッセージ */
.edit-status {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: bold;
}

.edit-status-ok {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.edit-status-error {
  background: #fce4ec;
  color: #c62828;
  border: 1px solid #f48fb1;
}

/* 編集フッター */
.edit-footer {
  display: flex;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid #eee;
  align-items: flex-start;
}

.edit-footer-save-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.btn-history {
  font-size: 11px;
  color: #888;
  background: #f5f5f5;
  border: 1px solid #ccc;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.btn-history:hover {
  background: #ebebeb;
  color: #555;
}

#node-history-section {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: 2px solid #c9d1d9;
  border-radius: 6px;
  margin-top: 12px;
  background: #f8f9fa;
  min-height: 48px;
  overflow: visible;
}

.history-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 1px solid #ddd;
  background: #f0f0f0;
  position: sticky;
  top: 0;
}

.history-section-title {
  font-size: 12px;
  font-weight: bold;
  color: #555;
}

.history-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  min-height: 52px;
  border-bottom: 1px solid #dde;
  font-size: 13px;
  background: #fff;
}

.history-row:hover {
  background: #f0f4ff;
}

.history-row:last-child {
  border-bottom: none;
}

.history-row-info {
  flex: 1;
  overflow: hidden;
}

.history-label {
  font-size: 11px;
  color: #666;
  margin-bottom: 2px;
}

.history-row-at {
  color: #666;
  white-space: nowrap;
  font-size: 12px;
}

.history-row-title {
  color: #222;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: bold;
  font-size: 13px;
}

.history-row-btn {
  flex-shrink: 0;
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  border: 1px solid #aaa;
  background: #fff;
  border-radius: 4px;
  white-space: nowrap;
}

.history-row-btn:hover {
  background: #e8f0fe;
  border-color: #4a86e8;
  color: #1a56c4;
}

/* ============================================================
   右カラム: プレビュー（既存スタイルを流用・最小修正）
   ============================================================ */
#right-column {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 32px;
  overflow-y: auto;
  gap: 20px;
  position: relative;
  background: #fff;
}

/* プレースホルダー（既存パターン） */
#preview-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aaa;
  font-size: 16px;
}

/* プレビューエリア */
#preview-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
}

/* パンくず（既存流用） */
#breadcrumb {
  font-size: 13px;
  color: #888;
  flex-shrink: 0;
}

.bc-item { color: #555; }
.bc-sep { color: #bbb; margin: 0 2px; }

/* ノードヘッダー（既存流用） */
#node-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 2px solid #4a90d9;
  padding-bottom: 10px;
  flex-shrink: 0;
}

#node-title {
  font-size: 26px;
  font-weight: bold;
  color: #1a1a2e;
  flex: 1;
}

.node-tags {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  padding-top: 6px;
}

.tag {
  font-size: 11px;
  font-weight: bold;
  padding: 3px 8px;
  border-radius: 4px;
}

.tag-start {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.tag-end {
  background: #fce4ec;
  color: #c62828;
  border: 1px solid #f48fb1;
}

/* ノードメタ情報（作成者・作成日・更新日） */
#node-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 0;
  margin: 2px 0 14px;
  min-height: 18px;
}

.meta-item {
  font-size: 12px;
  color: #888;
  letter-spacing: 0.02em;
}

.meta-author {
  font-weight: 600;
}

.meta-sep {
  font-size: 11px;
  color: #ccc;
  margin: 0 6px;
}

/* 本文（既存流用） */
#node-text {
  font-size: 16px;
  line-height: 1.9;
  white-space: pre-wrap;
  background: #f9fafb;
  border: 1px solid #dde1e7;
  border-radius: 8px;
  padding: 20px 24px;
  min-height: 60px;
  flex-shrink: 0;
}

/* 画像（既存流用） */
#node-image {
  max-width: 100%;
  width: auto;
  height: auto;
  border-radius: 8px;
  border: 1px solid #dde1e7;
  flex-shrink: 0;
}

/* 選択肢（既存流用） */
#node-choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.choice-btn {
  width: 100%;
  padding: 16px 24px;
  font-size: 16px;
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  min-height: 52px;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.choice-btn:hover:not(:disabled) {
  background: #357abd;
  transform: translateX(4px);
}

.choice-btn:active:not(:disabled) {
  background: #2a6099;
  transform: translateX(2px);
}

.choice-btn-disabled,
.choice-btn:disabled {
  background: #bbb;
  cursor: not-allowed;
  transform: none;
  opacity: 0.7;
}

/* 終了メッセージ */
.end-message {
  text-align: center;
  padding: 20px;
  color: #c62828;
  font-size: 15px;
  font-weight: bold;
  background: #fce4ec;
  border-radius: 8px;
  border: 1px solid #f48fb1;
}

/* ナビボタン（既存流用） */
#nav-buttons {
  display: flex;
  flex-direction: row;
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid #dde1e7;
  flex-shrink: 0;
}

.nav-btn {
  padding: 12px 24px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  min-height: 44px;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.nav-btn:hover:not(:disabled) { background: #f0f0f0; }
.nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ============================================================
   共通ボタン
   ============================================================ */
.btn-sm {
  padding: 3px 8px;
  font-size: 11px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: #555;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.btn-sm:hover { background: #f0f0f0; }

.btn-sm.btn-danger {
  color: #c0392b;
  border-color: #e0b0aa;
}

.btn-sm.btn-danger:hover {
  background: #fdf0ef;
  border-color: #c0392b;
}

.btn-sm.btn-primary-outline {
  color: #4a90d9;
  border-color: #4a90d9;
}

.btn-sm.btn-primary-outline:hover {
  background: #eaf2ff;
}

.btn-primary-sm {
  padding: 6px 12px;
  font-size: 13px;
  color: #fff;
  background: #4a90d9;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-primary-sm:hover { background: #357abd; }

.btn-primary {
  flex: 1;
  padding: 9px 16px;
  font-size: 14px;
  color: #fff;
  background: #4a90d9;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover { background: #357abd; }

/* 保存済み状態: 保存ボタンが緑になり変更がないことを示す */
.btn-primary.btn-saved { background: #27ae60; }
.btn-primary.btn-saved:hover { background: #27ae60; }

/* 非活性状態（保存済み／保存中） */
.btn-primary:disabled { cursor: default; }
/* 保存中（btn-savedなし＋disabled）は少し薄く */
.btn-primary:not(.btn-saved):disabled { opacity: 0.72; }

.btn-danger {
  flex: 1;
  padding: 9px 16px;
  font-size: 14px;
  color: #c0392b;
  background: #fff;
  border: 1px solid #e0b0aa;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-danger:hover {
  background: #fdf0ef;
  border-color: #c0392b;
}

/* ============================================================
   検索エリア（復元）
   ============================================================ */
#search-area {
  padding: 12px;
  border-bottom: 1px solid #dde1e7;
  flex-shrink: 0;
  position: relative;
}

#search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  background: #f9f9f9;
  font-family: inherit;
}

#search-input:focus {
  border-color: #4a90d9;
  background: #fff;
}

#search-results {
  position: absolute;
  top: calc(100% - 4px);
  left: 12px;
  right: 12px;
  background: #fff;
  border: 1px solid #dde1e7;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 200;
  max-height: 280px;
  overflow-y: auto;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid #f0f0f0;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: #f0f4fa; }

.search-result-type {
  font-size: 10px;
  color: #fff;
  background: #4a90d9;
  padding: 2px 5px;
  border-radius: 3px;
  flex-shrink: 0;
}

.search-empty {
  padding: 10px 12px;
  color: #aaa;
  font-size: 13px;
  text-align: center;
}

/* ============================================================
   右カラム上部バー（俯瞰ボタン復元）
   ============================================================ */
#right-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  min-height: 24px;
}

#right-topbar #breadcrumb {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#btn-overview {
  flex-shrink: 0;
  padding: 5px 12px;
  font-size: 12px;
  color: #4a90d9;
  background: #fff;
  border: 1px solid #4a90d9;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
#btn-overview:hover { background: #4a90d9; color: #fff; }

/* ============================================================
   俯瞰パネル（復元・右カラム上のオーバーレイ）
   ============================================================ */
#right-column {
  position: relative; /* オーバーレイのアンカー */
}

#overview-panel {
  position: absolute;
  inset: 0;
  background: #f4f6f8;
  z-index: 30;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#overview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  background: #fff;
  border-bottom: 1px solid #dde1e7;
  flex-shrink: 0;
}

#overview-title {
  font-size: 16px;
  font-weight: bold;
  color: #1a1a2e;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#btn-close-overview {
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: 13px;
  color: #555;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
#btn-close-overview:hover { background: #f0f0f0; }

#overview-cards {
  flex: 1;
  overflow: auto;
  padding: 28px 36px 56px;
  display: block;
}

.ov-card {
  background: #fff;
  border: 2px solid #dde1e7;
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ov-card:hover { border-color: #4a90d9; box-shadow: 0 2px 8px rgba(74,144,217,0.18); }
.ov-card.ov-current { border-color: #4a90d9; background: #eaf2ff; }

.ov-card-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.ov-badge {
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}
.ov-badge-start { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.ov-badge-current { background: #4a90d9; color: #fff; }
.ov-badge-end { background: #fce4ec; color: #c62828; border: 1px solid #f48fb1; }

.ov-card-title { font-size: 13px; font-weight: bold; color: #1a1a2e; word-break: break-all; }
.ov-card-text { font-size: 12px; color: #777; line-height: 1.5; word-break: break-all; }

.ov-card-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: auto;
}

.ov-choice-tag {
  font-size: 11px;
  padding: 2px 8px;
  background: #f0f4fa;
  color: #4a90d9;
  border-radius: 10px;
  border: 1px solid #c8ddf5;
}
.ov-choice-tag.ov-choice-end { background: #f5f5f5; color: #999; border-color: #ddd; }

/* ============================================================
   スマホ対応
   ============================================================ */
@media (max-width: 768px) {
  #app { flex-direction: column; overflow-y: auto; }
  #left-column { flex: 0 0 auto; max-height: 200px; border-right: none; border-bottom: 1px solid #dde1e7; }
  #center-column { flex: 0 0 auto; border-right: none; border-bottom: 1px solid #dde1e7; }
  /* モバイルでは flex: 1 が機能しないため px ベースに戻す */
  #node-list-area { flex: none; max-height: 200px; min-height: 80px; }
  #center-column.has-edit #node-list-area { flex: none; max-height: 150px; }
  #right-column { padding: 20px 16px; }
  .choice-btn { font-size: 15px; padding: 14px 18px; }
}

/* ============================================================
   表示設定・選択肢スタイルパネル
   ============================================================ */
.style-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.style-label {
  font-size: 11px;
  color: #666;
  flex: 0 0 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.style-select,
.style-input {
  flex: 1;
  min-width: 0;
  padding: 4px 7px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  background: #fff;
  outline: none;
  color: #333;
}

.style-select:focus,
.style-input:focus {
  border-color: #4a90d9;
}

/* ============================================================
   親子カテゴリ階層
   ============================================================ */

/* 親カテゴリ行 */
.pcat-row {
  background: #edf1f7;
}

.pcat-row:hover {
  background: #e2e8f2;
}

.pcat-row.pcat-active {
  background: #dde8f5;
  border-left-color: #4a90d9;
}

.pcat-row.pcat-active .pcat-name {
  color: #2c6db5;
}

/* トグルアイコン */
.cat-toggle {
  font-size: 10px;
  color: #888;
  padding: 0 4px 0 8px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

/* 親カテゴリ名 */
.pcat-name {
  font-weight: bold;
  font-size: 13px;
  color: #444;
}

/* 子カテゴリ行（インデント） */
.child-cat-row .row-name {
  padding-left: 28px;
  font-size: 13px;
}

/* 子カテゴリが空のときのヒント */
.child-empty-hint {
  padding: 5px 12px 5px 36px;
  font-size: 11px;
  color: #bbb;
  font-style: italic;
}

/* ============================================================
   作成者マスター・タグ
   ============================================================ */

/* 作成者セクション（左カラム） */
#authors-panel {
  flex: 0 0 auto;
}

/* ヘッダーはカーソルをポインターに（クリックでトグル） */
#authors-panel-header {
  cursor: pointer;
}

#author-list {
  overflow-y: auto;
  max-height: 160px;
}

/* 作成者行 */
.author-row {
  padding: 5px 6px 5px 10px;
  min-height: 36px;
}

.author-row .author-tag-list {
  flex: 1;
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 作成者追加フォーム */
#author-add-form {
  padding: 10px 12px;
  border-top: 1px solid #eee;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  background: #fafbfc;
}

.author-name-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: #fff;
}

.author-name-input:focus { border-color: #4a90d9; }

.author-color-swatches {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.author-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.12);
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
  flex-shrink: 0;
}

.author-swatch:hover { transform: scale(1.18); }
.author-swatch.selected { border-color: #333 !important; transform: scale(1.1); box-shadow: 0 0 0 2px #fff, 0 0 0 4px #555; }

.author-form-actions {
  display: flex;
  gap: 6px;
}

/* 作成者タグ（ノード一覧・俯瞰図共通） */
.author-tag {
  font-size: 10px;
  font-weight: bold;
  padding: 1px 7px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
  background: #e4e8ee;
  color: #444;
  line-height: 1.6;
}

/* 俯瞰図カード内の作成者タグ（少し大きめ） */
.author-tag-ov {
  font-size: 11px;
  padding: 2px 8px;
}

/* ---- 上部バー（俯瞰・全画面ボタン共通） ---- */
.btn-topbar {
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid #c8cdd6;
  border-radius: 6px;
  background: #fff;
  color: #555;
  cursor: pointer;
  white-space: nowrap;
}
.btn-topbar:hover { background: #f0f3f7; }

/* ---- 複数画像（プレビュー） ---- */
#node-images {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}
.node-image-item {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid #dde1e7;
  display: block;
}

/* ---- 複数画像（編集パネル） ---- */
#images-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 4px;
}
.image-item-block {
  border: 1px solid #dde1e7;
  border-radius: 8px;
  padding: 10px;
  background: #fafbfc;
}
.image-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.btn-img-delete {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #f5f7fa;
  color: #999;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-img-delete:hover {
  background: #fdf0ef;
  color: #c0392b;
  border-color: #c0392b;
}
.image-item-label {
  font-size: 12px;
  font-weight: bold;
  color: #555;
}
.images-empty-hint {
  font-size: 12px;
  color: #bbb;
  padding: 8px 0;
  text-align: center;
}

/* ---- ログイン画面 ---- */
#login-screen {
  position: fixed;
  inset: 0;
  background: #f0f4fa;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  padding: 40px 36px;
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-title {
  font-size: 20px;
  font-weight: bold;
  color: #222;
  margin: 0 0 2px;
  text-align: center;
}

.login-subtitle {
  font-size: 13px;
  color: #888;
  margin: 0 0 16px;
  text-align: center;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}

.login-input:focus { border-color: #4a90d9; }

.login-error {
  font-size: 12px;
  color: #c0392b;
  background: #fdf0ef;
  border: 1px solid #e0b0aa;
  border-radius: 4px;
  padding: 6px 10px;
}

.login-success {
  font-size: 13px;
  color: #1a6e2e;
  background: #eafaf0;
  border: 1px solid #a3d9b1;
  border-radius: 4px;
  padding: 8px 10px;
  line-height: 1.5;
}

.login-btn {
  padding: 10px;
  font-size: 14px;
  font-weight: bold;
  color: #fff;
  background: #4a90d9;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 4px;
}

.login-btn:hover:not(:disabled) { background: #357abd; }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ---- ユーザーバー ---- */
#user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid #e8ecf1;
  background: #f7f9fc;
  flex-shrink: 0;
}

.user-email {
  font-size: 11px;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
}

/* ---- 全画面モード ---- */
#right-column.fullscreen-mode {
  position: fixed;
  inset: 0;
  z-index: 500;
  padding: 40px 80px;
  background: #fff;
  overflow-y: auto;
  width: auto;
}

/* ---- 俯瞰ツリー（横並びレイアウト） ---- */
.ov-card {
  max-width: 260px;
}

.ov-tree-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 0;
}

/* 縦コネクタ（親カードと子グループをつなぐ） */
.ov-tree-connector {
  width: 2px;
  height: 16px;
  background: #c8cdd6;
  flex-shrink: 0;
  align-self: center;
}

.ov-tree-children {
  display: flex;
  flex-direction: row;     /* 横並び */
  align-items: flex-start;
  justify-content: center;
  gap: 12px;
  margin-left: 0;
  padding-left: 0;
  border-left: none;
  margin-top: 0;
  padding-top: 0;
  position: relative;
}

/* 各ブランチの縦コネクタ（ブランチラベルの上） */
.ov-tree-branch {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding-top: 0;
}

.ov-tree-branch::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 16px;
  background: #c8cdd6;
}

/* ブランチラベル: コネクタ分のpaddingを追加 */
.ov-branch-label {
  font-size: 10px;
  color: #888;
  background: #f0f3f7;
  border-radius: 3px;
  padding: 1px 6px;
  display: inline-block;
  margin-top: 16px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

/* ブランチラベルなし（最初の子がtree-wrapの場合）のtop spacing */
.ov-tree-branch > .ov-tree-wrap:first-child {
  margin-top: 16px;
}

.ov-tree-toggle {
  width: 16px;
  height: 16px;
  background: #f0f3f7;
  border: 1px solid #c8cdd6;
  border-radius: 3px;
  cursor: pointer;
  color: #666;
  font-size: 8px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}
.ov-tree-toggle:hover { background: #e4e8f0; }

.ov-card.ov-ref {
  opacity: 0.6;
  border-style: dashed;
}
.ov-badge-ref {
  background: #e8eaf6;
  color: #3949ab;
  font-size: 11px;
}
.ov-badge-last { background: #fff8e1; color: #b45309; border: 1px solid #fcd34d; }

/* ---- 子カテゴリパネル ---- */
#child-cat-panel {
  position: absolute;
  top: 50px;
  right: 16px;
  background: #fff;
  border: 1px solid #dde1e7;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.13);
  z-index: 60;
  min-width: 200px;
  max-width: 280px;
  max-height: 320px;
  overflow-y: auto;
}

.child-cat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #eee;
  font-size: 13px;
  font-weight: bold;
  color: #333;
  position: sticky;
  top: 0;
  background: #fff;
}

.child-cat-item {
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid #f5f5f5;
  color: #333;
  transition: background 0.12s;
}
.child-cat-item:last-child { border-bottom: none; }
.child-cat-item:hover { background: #f0f4fa; color: #4a90d9; }
.child-cat-item.active { background: #eaf2ff; color: #4a90d9; font-weight: bold; }

.child-cat-empty {
  padding: 16px 14px;
  font-size: 12px;
  color: #bbb;
  text-align: center;
}

/* ============================================================
   管理画面
   ============================================================ */

/* 管理画面入口ボタン（ユーザーバー内） */
.btn-admin-entry {
  background: #2c3e50;
  color: #fff;
  border: none;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}
.btn-admin-entry:hover { background: #1a252f; }

/* 管理画面全体 */
#admin-screen {
  position: fixed;
  inset: 0;
  background: #f0f2f5;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ヘッダー */
#admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 52px;
  background: #2c3e50;
  color: #fff;
  flex-shrink: 0;
  gap: 16px;
}
#admin-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
#admin-title {
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 0.02em;
}
#admin-user-label {
  font-size: 12px;
  color: #aab8c2;
}
.btn-admin-back {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-admin-back:hover { background: rgba(255,255,255,0.22); }

/* コンテンツエリア */
#admin-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 28px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* フィルターエリア */
#admin-filters {
  background: #fff;
  border: 1px solid #dde1e7;
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.admin-filter-label {
  font-size: 12px;
  font-weight: bold;
  color: #555;
  white-space: nowrap;
}
.admin-date-input {
  border: 1px solid #c8cdd6;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 13px;
  color: #333;
  background: #fff;
}
.admin-date-input:focus { outline: none; border-color: #4a90d9; }
.admin-select {
  border: 1px solid #c8cdd6;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 13px;
  color: #333;
  background: #fff;
  min-width: 200px;
}
.admin-select:focus { outline: none; border-color: #4a90d9; }
.admin-select-wide { min-width: 220px; max-width: 320px; }
.admin-text-input {
  border: 1px solid #c8cdd6;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 13px;
  color: #333;
  background: #fff;
  width: 200px;
}
.admin-text-input:focus { outline: none; border-color: #4a90d9; }
.admin-filter-row { flex-wrap: wrap; }
.btn-admin-search {
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 20px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
}
.btn-admin-search:hover { background: #357abd; }

.admin-log-status {
  font-size: 12px;
  color: #777;
  min-height: 16px;
}
.admin-log-status-error { color: #c0392b; font-weight: bold; }

/* ログ一覧 トグルヘッダー */
.admin-table-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 10px 14px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  margin-bottom: 0;
  user-select: none;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}
.admin-table-toggle:hover { background: #e2e8f0; }
.admin-table-arrow { font-size: 11px; color: #6b7280; }

/* ---- グラフ切替コントロール ---- */
.chart-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.ctrl-group {
  display: flex;
  gap: 2px;
  background: #f1f5f9;
  border-radius: 6px;
  padding: 2px;
}

.ctrl-btn {
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 500;
  color: #6b7280;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.4;
}

.ctrl-btn:hover {
  background: #e2e8f0;
  color: #374151;
}

.ctrl-btn.active {
  background: #fff;
  color: #1d4ed8;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,0.10);
}

/* ---- 日別/月別 粒度タブ ---- */
.granularity-tabs {
  display: flex;
  gap: 4px;
  margin: 6px 0 2px;
}
.gran-tab-btn {
  padding: 3px 12px;
  font-size: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #f5f7fa;
  cursor: pointer;
  color: #555;
  font-weight: 500;
}
.gran-tab-btn:hover { background: #e2e8f0; }
.gran-tab-btn.active {
  background: #4a90d9;
  border-color: #4a90d9;
  color: #fff;
  font-weight: 700;
}

/* ログテーブル */
#admin-table-wrap {
  background: #fff;
  border: 1px solid #dde1e7;
  border-top: none;
  border-radius: 0 0 10px 10px;
  overflow-x: auto;
  flex: 1;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.admin-table thead tr {
  background: #f4f6f8;
  border-bottom: 2px solid #dde1e7;
}
.admin-table th {
  padding: 10px 14px;
  text-align: left;
  font-weight: bold;
  color: #444;
  white-space: nowrap;
}
.admin-table td {
  padding: 8px 14px;
  border-bottom: 1px solid #eef0f3;
  color: #333;
  vertical-align: top;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-table tbody tr:hover { background: #f8fafc; }

/* event_type 色分け */
.admin-table td[data-event="view_category"] { color: #6d4c99; }
.admin-table td[data-event="view_node"]     { color: #2e7d32; }
.admin-table td[data-event="select_option"] { color: #e67e22; }
.admin-table td[data-event="save_node"]     { color: #1565c0; }

.admin-table-empty {
  text-align: center;
  padding: 40px;
  color: #aaa;
  font-size: 13px;
}

/* ---- 管理画面 グラフエリア ---- */
#admin-charts {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-chart-row {
  display: flex;
  gap: 16px;
}

.admin-chart-row-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.admin-chart-row-2col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

/* ---- 利用分析 / 作成分析 セクション区切り ---- */
.admin-section {
  border: 1px solid #e2e5ea;
  border-radius: 12px;
  padding: 0 20px 20px;
  margin-bottom: 24px;
  background: #fafbfc;
}

.admin-section-heading {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  padding: 14px 0 10px;
  margin-bottom: 4px;
  border-bottom: 2px solid #4a90d9;
  display: inline-block;
}

/* 作成分析の見出し色（2番目のセクション） */
.admin-section:nth-child(2) .admin-section-heading {
  border-bottom-color: #8e44ad;
}

/* ---- 利用傾向分析セクション ---- */
.admin-section-ranking .admin-section-heading {
  border-bottom-color: #e67e22;
}
/* ---- 利用者登録セクション ---- */
.admin-section-users .admin-section-heading {
  border-bottom-color: #27ae60;
}

.admin-ranking-note {
  font-size: 11px;
  color: #9ca3af;
  margin: -4px 0 12px;
}

.admin-ranking-group-label {
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 4px;
  margin: 14px 0 8px;
  letter-spacing: 0.03em;
}
.admin-ranking-label-unused { background: #fef3c7; color: #92400e; }
.admin-ranking-label-low    { background: #dbeafe; color: #1e40af; }
.admin-ranking-label-high   { background: #dcfce7; color: #166534; }

/* ---- ユーザーランキング 切替タブ ---- */
.user-rank-tabs {
  display: inline-flex;
  gap: 4px;
  margin-left: 10px;
  vertical-align: middle;
}
.user-rank-tab {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 3px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  line-height: 1.6;
}
.user-rank-tab:hover { background: #f3f4f6; }
.user-rank-tab-active {
  background: #4a90d9;
  color: #fff;
  border-color: #4a90d9;
}

.admin-ranking-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 4px;
}

.admin-ranking-box {
  background: #fff;
  border: 1px solid #dde1e7;
  border-radius: 10px;
  padding: 14px 16px;
  min-width: 0;
}

.admin-ranking-title {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-ranking-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 10px;
}
.admin-badge-unused { background: #fef3c7; color: #92400e; }

/* 未使用一覧 */
.admin-ranking-list {
  max-height: 260px;
  overflow-y: auto;
}

.admin-ranking-item {
  font-size: 12px;
  color: #374151;
  padding: 5px 0;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.admin-ranking-item:last-child { border-bottom: none; }

.rk-cat {
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
  flex-shrink: 0;
}

.rk-role {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  background: #e0f2fe;
  color: #0369a1;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ランキング ol */
.admin-ranking-ol {
  margin: 0;
  padding: 0 0 0 22px;
  max-height: 360px;
  overflow-y: auto;
}

.admin-ranking-li {
  font-size: 12px;
  color: #374151;
  padding: 5px 0;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.admin-ranking-li:last-child { border-bottom: none; }

.rk-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rk-count {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  white-space: nowrap;
  flex-shrink: 0;
}

.admin-ranking-empty {
  font-size: 12px;
  color: #9ca3af;
  font-style: italic;
}

/* ---- フィルターブロック共通 ---- */
.admin-filters-block {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 14px 6px;
  margin-bottom: 16px;
}

.admin-filter-block-label {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.admin-chart-box {
  background: #fff;
  border: 1px solid #dde1e7;
  border-radius: 10px;
  padding: 16px 20px;
  min-width: 0;
}

.admin-chart-box-full {
  flex: 1;
}

.admin-chart-title {
  font-size: 12px;
  font-weight: bold;
  color: #555;
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}

/* 折れ線・縦棒: 固定高さ */
.admin-chart-canvas-wrap {
  position: relative;
  height: 200px;
}

/* 横棒グラフ: 高さ可変（JS で動的設定） */
.admin-chart-canvas-wrap-h {
  position: relative;
  height: 160px; /* JS で上書きされる初期値 */
}

/* クリック連動グラフ: pointer cursor */
#chart-events,
#wrap-chart-users canvas,
#wrap-chart-nodes canvas {
  cursor: pointer;
}

/* ==========================================
   注釈編集
   ========================================== */
.annot-wrapper {
  position: relative;
  display: block;
  line-height: 0;
}
.annot-wrapper .edit-image-preview {
  display: block;
}
.annot-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}
.annot-layer.annot-layer-active {
  pointer-events: all;
  cursor: crosshair;
}
.annot-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 6px 0 2px;
  margin-top: 4px;
  border-top: 1px solid #e5e7eb;
  line-height: 1;
}
.btn-annot-toggle {
  margin-top: 4px;
  padding: 3px 10px;
  font-size: 11px;
  border: 1px solid #aaa;
  border-radius: 4px;
  background: #f5f5f5;
  cursor: pointer;
  color: #333;
  line-height: 1.5;
}
.btn-annot-toggle.active {
  background: #3b82f6;
  color: #fff;
  border-color: #2563eb;
}
.btn-annot-tool {
  padding: 2px 7px;
  font-size: 11px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  line-height: 1.6;
  white-space: nowrap;
}
.btn-annot-tool.annot-tool-active {
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1d4ed8;
}
.btn-annot-del {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}
.annot-color-input {
  width: 28px;
  height: 24px;
  padding: 1px;
  border: 1px solid #ccc;
  border-radius: 3px;
  cursor: pointer;
  vertical-align: middle;
}
.annot-sep {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: #ddd;
  margin: 0 2px;
  vertical-align: middle;
}
.annot-obj {
  position: absolute;
  box-sizing: border-box;
  cursor: move;
  user-select: none;
  -webkit-user-select: none;
}
.annot-obj-rect {
  border: 2px solid;
  background: transparent;
  min-width: 16px;
  min-height: 16px;
}
.annot-obj-circle {
  border: 2px solid;
  border-radius: 50%;
  background: transparent;
  min-width: 16px;
  min-height: 16px;
}
.annot-obj-text {
  border: none;
  background: transparent;
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
  padding: 1px 2px;
  min-width: 10px;
  min-height: 14px;
}
.annot-obj.annot-selected {
  outline: 2px dashed #3b82f6;
  outline-offset: 2px;
}

/* 右カラム 注釈レイヤー */
.annot-right-wrapper {
  position: relative;
  display: block;
  line-height: 0;
  overflow: visible; /* 注釈が画像外にはみ出してもクリップしない */
}
.annot-right-wrapper .node-image-item {
  display: block;
}
.annot-right-layer {
  position: absolute;
  inset: -80px;        /* 画像外80pxまで拡張（ANNOT_RIGHT_PAD と合わせる） */
  pointer-events: none;
  z-index: 10;
  overflow: visible;
}
.annot-right-layer.annot-right-active {
  pointer-events: all;
}

/* リサイズハンドル */
.annot-handle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #fff;
  border: 1.5px solid #3b82f6;
  border-radius: 1px;
  z-index: 2;
  pointer-events: all;
}

/* 注釈ツールバー セレクト */
.annot-select {
  height: 24px;
  padding: 0 4px;
  font-size: 11px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  vertical-align: middle;
}

/* テキスト注釈: contentEditable 中 */
.annot-obj-text[contenteditable="true"] {
  outline: 2px solid #3b82f6;
  cursor: text;
  background: rgba(255,255,255,0.85);
  min-width: 40px;
}

/* ============================================================
   一括選択肢モード専用レイアウト
   #right-bulk-layout が右カラムの 2 コンテナ構造を明示的に管理する
   ============================================================ */

/* 一括モード専用コンテナ（right-column の padding を打ち消す） */
#right-bulk-layout {
  display: flex;          /* JS で none ↔ flex を切替 */
  flex-direction: column;
  margin: -32px;
  width: calc(100% + 64px);
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}

/* 上部: 一括選択肢設定パネルを格納するコンテナ（約60%） */
#bulk-panel-area {
  flex: 3 1 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-bottom: 2px solid #c9d1d9;
}

/* 上部内の一括パネル本体（#bulk-panel-area が親なのでネガマージン不要） */
#bulk-choices-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #fff;
  /* margin/width は #bulk-panel-area が管理するためリセット */
  margin: 0;
  width: 100%;
}

/* 下部: 一括モード専用ノードプレビュー（約40%） */
#bulk-preview-area {
  flex: 2 1 0;
  min-height: 0;
  overflow-y: auto;
  background: #f8f9fa;
  padding: 16px 18px;
}

/* 下部: 未選択時のプレースホルダー */
#bulk-preview-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 80px;
  color: #aaa;
  font-size: 12px;
  text-align: center;
}

/* 下部: 選択ノードのプレビュー内容 */
#bulk-preview-title {
  font-size: 15px;
  font-weight: 600;
  color: #222;
  margin-bottom: 8px;
  border-bottom: 1px solid #e2e5ea;
  padding-bottom: 6px;
}

#bulk-preview-text {
  font-size: 12px;
  color: #555;
  white-space: pre-wrap;
  line-height: 1.6;
  margin-bottom: 12px;
}

#bulk-preview-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bulk-preview-opt {
  font-size: 12px;
  padding: 5px 10px;
  background: #fff;
  border: 1px solid #dde1e7;
  border-radius: 4px;
  color: #333;
}

.bulk-choices-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #dde1e7;
  flex-shrink: 0;
  background: #f8f9fa;
}

.bulk-choices-title {
  font-size: 13px;
  font-weight: 600;
  color: #333;
}

#bulk-choices-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}

/* ノードごとのカード */
.bulk-node-block {
  border: 1px solid #dde1e7;
  border-radius: 6px;
  margin-bottom: 10px;
  background: #fafbfc;
  padding: 10px 12px;
}

.bulk-node-title {
  font-size: 12px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 選択肢リスト */
.bulk-options-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 6px;
}

/* 選択肢1行（縦方向：メイン行 + スタイルパネル） */
.bulk-opt-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

/* メイン行（ラベル・遷移先・ボタン群） */
.bulk-opt-main {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bulk-opt-label {
  flex: 0 0 100px;
  height: 26px;
  font-size: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 0 6px;
}

.bulk-opt-select {
  flex: 1;
  height: 26px;
  font-size: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  padding: 0 4px;
  cursor: pointer;
  min-width: 0;
}

/* ラベル新規作成ボタン */
.bulk-add-opt-btn {
  font-size: 11px;
  color: #3b82f6;
  background: none;
  border: 1px dashed #3b82f6;
  border-radius: 4px;
  padding: 3px 10px;
  cursor: pointer;
  width: 100%;
  text-align: center;
  margin-top: 2px;
}

.bulk-add-opt-btn:hover {
  background: #eff6ff;
}

.bulk-choices-footer {
  padding: 10px 14px;
  border-top: 1px solid #dde1e7;
  flex-shrink: 0;
  background: #f8f9fa;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

#btn-exit-bulk-mode {
  font-size: 11px;
  color: #555;
  border-color: #bbb;
}
#btn-exit-bulk-mode:hover {
  background: #e8eaed;
}
