/* ================= MAIN SPLIT ================= */
.main-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: 0;
}
@media (max-width: 860px) {
  .main-layout { grid-template-columns: 1fr; }
}

.tree-pane {
  border-right: 1px solid var(--rule);
  padding: 16px;
  overflow-y: auto;
  background: rgba(20, 51, 90, 0.35);
}
.tree-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--ink-faint);
  text-transform: uppercase;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--rule);
}
.tree-pane-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-mode-select {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  color: var(--ink-dim);
  padding: 7px 10px;
  font-size: 12px;
  font-family: var(--font-sans);
  text-transform: none;
  letter-spacing: normal;
}
.detail-mode-select:focus { outline: none; border-color: var(--accent); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tree-empty {
  font-size: 12px;
  color: var(--ink-faint);
  line-height: 1.8;
  padding: 20px 4px;
}

/* ---- search + status filter bar ---- */
.tree-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--rule);
}
.tree-search-input {
  flex: 1 1 160px;
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 6px 10px;
  font-size: 12px;
  font-family: var(--font-sans);
}
.tree-search-input:focus { outline: none; border-color: var(--accent); }
.tree-status-filter { display: flex; flex-wrap: wrap; gap: 4px; }
.tree-filter-group-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.tree-filter-group-label {
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 11px;
}
.status-filter-chip,
.priority-filter-chip {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
}
.status-filter-chip:hover { border-color: var(--accent); color: var(--ink); }
.priority-filter-chip:hover { border-color: var(--accent); color: var(--ink); }
.priority-filter-chip[data-priority="high"],
.priority-filter-chip[data-priority="medium"],
.priority-filter-chip[data-priority="low"] {
  min-width: 40px;
  text-align: center;
}
.status-filter-chip[data-status="not_started"].active { border-color: var(--ink-faint); color: var(--ink); background: rgba(255,255,255,0.06); }
.status-filter-chip[data-status="in_progress"].active { border-color: var(--amber); color: var(--amber); }
.status-filter-chip[data-status="in_review"].active { border-color: var(--accent); color: var(--accent); }
.status-filter-chip[data-status="done"].active { border-color: var(--green); color: var(--green); }
.priority-filter-chip.active { border-color: var(--accent); color: var(--accent); background: rgba(127, 209, 232, 0.08); }
.tree-filter-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  white-space: nowrap;
}
.tree-row.search-match,
.tree-row.filter-match { border-color: var(--accent); }
.tree-row.search-match .tree-row-title,
.tree-row.filter-match .tree-row-title { color: var(--accent); }
.tree-row.search-descendant-match { background: rgba(127, 209, 232, 0.04); }
.tree-row.filter-ancestor .tree-row-title { color: var(--ink-faint); }
.tree-drag-handle.disabled { color: var(--ink-faint); opacity: 0.3; cursor: default; }
.tree-drag-handle.disabled:hover { color: var(--ink-faint); }

/* ---- tree nodes: connectors are structural, not decorative ---- */
.tree-root { display: flex; flex-direction: column; }
.tree-children {
  display: flex;
  flex-direction: column;
  margin-left: 18px;
  border-left: 1px solid var(--rule);
  padding-left: 14px;
}
.tree-node { position: relative; }
.tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  cursor: pointer;
  border: 1px solid transparent;
  font-size: 13px;
}
.tree-row:hover { background: rgba(127, 209, 232, 0.08); }
.tree-row.selected {
  background: rgba(127, 209, 232, 0.14);
  border-color: var(--accent);
}
.tree-toggle {
  width: 18px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 11px;
  flex-shrink: 0;
  text-align: center;
  padding: 4px 0;
}
.tree-toggle.has-children {
  color: var(--accent);
  cursor: pointer;
}
.tree-toggle.has-children:hover { color: var(--ink); }

.tree-drag-handle {
  width: 22px;
  flex-shrink: 0;
  text-align: center;
  color: var(--ink-faint);
  font-size: 14px;
  cursor: grab;
  touch-action: none;
  padding: 7px 4px; /* タッチ操作でつまみやすいよう当たり判定を広げる（行全体の高さも少し広がる） */
}
.tree-drag-handle:hover { color: var(--accent); }
.tree-drag-handle:active { cursor: grabbing; }

.tree-row.dragging-source { opacity: 0.4; }
.tree-row.drag-over-top { box-shadow: inset 0 2px 0 0 var(--accent); }
.tree-row.drag-over-bottom { box-shadow: inset 0 -2px 0 0 var(--accent); }
.tree-status-mark {
  width: 9px; height: 9px;
  flex-shrink: 0;
  border: 1.5px solid var(--ink-faint);
}
.tree-status-mark.not_started { border-color: var(--ink-faint); background: transparent; }
.tree-status-mark.in_progress { border-style: dashed; border-color: var(--amber); }
.tree-status-mark.in_review { border-color: var(--accent); background: transparent; }
.tree-status-mark.done { border-color: var(--green); background: var(--green); }

.tree-aggregate {
  display: flex;
  height: 8px;
  width: 34px;
  flex-shrink: 0;
  border: 1px solid var(--rule);
  overflow: hidden;
}
.tree-aggregate span { display: block; height: 100%; }
.tree-aggregate span.not_started { background: var(--ink-faint); }
.tree-aggregate span.in_progress { background: var(--amber); }
.tree-aggregate span.in_review { background: var(--accent); }
.tree-aggregate span.done { background: var(--green); }

.tree-review-badge {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  border: 1px solid var(--review);
  color: var(--review);
  white-space: nowrap;
}
.tree-review-badge.review-today { background: var(--review); color: var(--paper); font-weight: 700; }
.tree-review-badge.review-overdue { border-color: var(--red); color: var(--red); }

.tree-match-tag {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  border: 1px solid var(--accent);
  color: var(--accent);
  white-space: nowrap;
}
.tree-task-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}

.tree-row-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  line-height: 1.3;
}
.tree-row-title.empty { color: var(--ink-faint); font-style: italic; }
.tree-add-child {
  opacity: 0.55;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 4px 6px;
  flex-shrink: 0;
}
.tree-row:hover .tree-add-child { opacity: 1; }
.tree-add-child:hover, .tree-add-child:active { color: var(--accent); opacity: 1; }

/* ================= DETAIL PANE ================= */
.detail-pane {
  padding: 28px 36px;
  overflow-y: auto;
}
@media (max-width: 640px) {
  /* スマホ幅ではガント/今日タブと同様、余白を切り詰めて可視面積を確保する。
     .detail-toolbar の負のマージン（stickyヘッダーの帯を左右いっぱいに
     広げるため）もここに合わせて縮小する必要がある。 */
  .detail-pane { padding: 16px; }
}
.detail-empty {
  color: var(--ink-faint);
  font-size: 13px;
  margin-top: 60px;
  text-align: center;
}
#detail-form {
  display: flex;
  flex-direction: column;
}

#detail-form > .detail-mode-divider {
  display: none;
}

#detail-form.detail-mode-view > .detail-title-row { order: 1; }
#detail-form.detail-mode-view > .detail-owner-row { order: 2; }
#detail-form.detail-mode-view > .detail-planning-section { order: 3; }
#detail-form.detail-mode-view > .detail-context-section { order: 4; }
#detail-form.detail-mode-view > .detail-comment-section { order: 5; }
#detail-form.detail-mode-view > .detail-mode-divider {
  display: block;
  order: 6;
}
#detail-form.detail-mode-view > .detail-decision-section { order: 7; }
#detail-form.detail-mode-view > .detail-dependency-section { order: 8; }

#detail-form.detail-mode-view .detail-decision-section textarea:read-only {
  cursor: default;
  opacity: 0.9;
}
#detail-form.detail-mode-view .detail-dependency-section .dependency-add-row {
  display: none;
}
#detail-form.detail-mode-view .detail-dependency-section .dependency-chip-remove {
  display: none;
}
#detail-form.detail-mode-view .detail-mode-divider {
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 14px 0 0;
  border-top: 1px dashed var(--rule);
}

.detail-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: -28px;
  z-index: 5;
  margin: -28px -36px 18px -36px;
  padding: 20px 36px 14px;
  background: var(--paper);
  border-bottom: 1px dashed var(--rule);
}
@media (max-width: 640px) {
  .detail-toolbar {
    flex-wrap: wrap;
    top: -16px;
    margin: -16px -16px 16px -16px;
    padding: 16px 16px 12px;
  }
  /* 折り返した2行目に単独で残ると不自然なため、保存状態インジケーターは
     全幅を取って独立した行にする（右寄せ→行末表示は維持）。 */
  .detail-toolbar .save-indicator { flex-basis: 100%; margin-left: 0; text-align: right; }
}
.detail-row.detail-title-row {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}
.detail-title-field {
  flex: 1;
  min-width: 0;
}

.detail-owner-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

#detail-form:not(.detail-mode-view) > .detail-owner-row {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px dashed var(--rule);
  margin-bottom: 24px;
}


.field-attribute-select {
  width: 100%;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 6px 10px;
  font-size: 12px;
  font-family: var(--font-sans);
}

.field-attribute-select:focus {
  outline: none;
  border-color: var(--accent);
}

@media (max-width: 640px) {
  /* ノード名の説明を入力欄の上に置きつつ、セレクトを下段へ送って
     タッチ操作の当たり判定を確保する。 */
  .detail-row.detail-title-row { flex-wrap: wrap; }
  .detail-row.detail-title-row .detail-title-field { flex-basis: 100%; }
}
@media (max-width: 640px) {
  .detail-owner-row { grid-template-columns: 1fr; }
}


.detail-section {
  margin-top: 20px;
  padding-top: 4px;
}

.detail-section-heading {
  height: 0;
  margin: 0 0 12px;
  padding: 0;
  border-bottom: 1px dashed var(--rule);
}



.detail-context-section .detail-memo-block {
  margin-bottom: 18px;
}

.detail-planning-section .date-grid {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.detail-planning-section .milestone-section {
  margin-top: 8px;
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.detail-dependency-section .dependency-section {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.detail-dependency-section .dependency-section + .dependency-section {
  margin-top: 14px;
}

.detail-comment-section .comment-section {
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-top: none;
}
.field-title {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  color: var(--ink);
  font-size: 20px;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 4px 2px;
}
.field-title-error {
  margin: 4px 2px 0;
  color: var(--red);
  font-size: 11px;
  line-height: 1.4;
}
.field-title:focus { outline: none; border-bottom-color: var(--accent); }
.field-title::placeholder { color: var(--ink-faint); font-weight: 400; }

.field-status {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 6px 10px;
  font-size: 12px;
  align-self: center;
}
.field-status.status-not_started { border-color: var(--ink-faint); color: var(--ink-dim); }
.field-status.status-in_progress { border-color: var(--amber); color: var(--amber); }
.field-status.status-in_review { border-color: var(--accent); color: var(--accent); }
.field-status.status-done { border-color: var(--green); color: var(--green); }
.date-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px dashed var(--rule);
}
@media (max-width: 640px) {
  .date-grid { grid-template-columns: 1fr 1fr; }
}
.date-grid input[type="date"] {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 8px 10px;
  font-size: 12px;
  font-family: var(--font-mono);
  color-scheme: dark;
}
.date-grid input[type="date"]:focus { outline: none; border-color: var(--accent); }

.effort-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 8px 0;
}
.effort-grid input[type="text"] {
  width: 100%;
  min-width: 0;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 8px 10px;
  font-size: 12px;
  font-family: var(--font-sans);
}
.effort-grid input[type="text"]:focus { outline: none; border-color: var(--accent); }
@media (max-width: 640px) {
  .effort-grid { gap: 10px; }
}


/* ================= NODE MILESTONES ================= */
.milestone-section {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px dashed var(--rule);
}
.milestone-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.milestone-entry {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px 10px;
  background: var(--paper-raised);
  border-left: 2px solid var(--review);
  padding: 8px 10px;
}
.milestone-entry-meta {
  flex: 0 0 100%;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  overflow-wrap: anywhere;
}
.milestone-entry-content {
  flex: 1 1 180px;
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.milestone-entry-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.milestone-entry-actions button {
  background: transparent;
  border: none;
  color: var(--ink-faint);
  font-size: 11px;
  padding: 2px 4px;
  cursor: pointer;
}
.milestone-entry-actions button:hover { color: var(--accent); }
.milestone-entry-actions .milestone-remove:hover { color: var(--red); }
.milestone-edit-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.milestone-edit-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.milestone-edit-fields input[type="date"] {
  flex: 0 1 160px;
  min-width: 140px;
  background: var(--paper);
  border: 1px solid var(--review);
  color: var(--ink);
  padding: 8px 10px;
  font-size: 12px;
  font-family: var(--font-mono);
  color-scheme: dark;
}
.milestone-edit-fields input[type="text"] {
  flex: 1 1 180px;
  min-width: 140px;
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 8px 10px;
  font-size: 13px;
}
.milestone-edit-fields input:focus { outline: none; border-color: var(--accent); }
.milestone-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.milestone-edit-actions .btn-secondary {
  padding: 5px 12px;
  font-size: 11px;
}
.milestone-add-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
.milestone-empty {
  color: var(--ink-faint);
  font-size: 11px;
  padding: 6px 0;
}

/* ================= NODE COMMENTS ================= */
.comment-section {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px dashed var(--rule);
  margin-bottom: 24px;
  padding-bottom: 20px;
}
.comment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.comment-entry {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--paper-raised);
  border-left: 2px solid var(--review);
  padding: 8px 10px;
}
.comment-meta {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-faint);
  white-space: nowrap;
  padding-top: 2px;
}
.comment-content {
  flex: 1;
  min-width: 0;
}
.comment-content .comment-note {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.comment-entry.comment-editing {
  flex-direction: column;
  align-items: stretch;
}
.comment-entry.comment-editing .comment-meta { white-space: normal; }
.comment-remove {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--ink-faint);
  font-size: 11px;
  padding: 2px 4px;
  cursor: pointer;
}
.comment-remove:hover { color: var(--red); }
.comment-edit {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--ink-faint);
  font-size: 11px;
  padding: 2px 4px;
  cursor: pointer;
}
.comment-edit:hover { color: var(--accent); }
.comment-edit-form {
  flex: 1;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.comment-edit-form textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 140px;
  background: var(--paper);
  border: 1px solid var(--accent);
  color: var(--ink);
  padding: 10px 12px;
  font: inherit;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
}
.comment-edit-form textarea:focus { outline: none; }
.comment-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.comment-edit-actions .btn-secondary, .comment-edit-actions .btn-danger {
  padding: 5px 12px;
  font-size: 11px;
}
.comment-add-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.comment-add-inputs {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 200px;
}
.comment-add-row textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}
.comment-add-row textarea:focus { outline: none; border-color: var(--accent); }

/* 画面幅によらずメタデータと本文を分け、本文の横幅を確保する。 */
.comment-entry:not(.comment-editing) {
  flex-wrap: wrap;
}
.comment-entry:not(.comment-editing) .comment-meta {
  flex: 0 0 100%;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}
.comment-entry:not(.comment-editing) .comment-content {
  flex: 1 0 100%;
}
.comment-entry:not(.comment-editing) > .comment-edit:first-of-type {
  margin-left: auto;
}

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

.detail-decision-section .field-label {
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

.field-block { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--ink-dim);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.field-hint { color: var(--ink-faint); font-family: var(--font-sans); font-size: 11px; font-weight: 400; }
.field-block textarea {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
}
.field-block textarea:focus { outline: none; border-color: var(--accent); }

/* Links extracted from text fields. The textarea remains the source of truth. */
.url-link-preview {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.url-link-preview a {
  color: var(--accent);
  text-decoration: underline;
  overflow-wrap: anywhere;
  word-break: break-word;
  cursor: pointer;
}
.url-link-preview a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.url-link-preview[hidden] { display: none; }
.issue-card-url-preview { margin-top: 4px; }

/* ================= DEPENDENCY SECTION ================= */
.dependency-section {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px dashed var(--rule);
}
.dependency-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}
.dependency-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  padding: 5px 6px 5px 10px;
  font-size: 12px;
  color: var(--ink);
}
.dependency-chip.critical { border-color: var(--red); color: var(--red); }
.dependency-chip-label { cursor: pointer; }
.dependency-chip-label:hover { color: var(--accent); text-decoration: underline; }
.dependency-chip-remove {
  background: transparent;
  border: none;
  color: var(--ink-faint);
  font-size: 13px;
  padding: 2px 4px;
  line-height: 1;
}
.dependency-chip-remove:hover { color: var(--red); }
.dependency-chip-empty {
  font-size: 12px;
  color: var(--ink-faint);
  font-style: italic;
}
.dependency-add-row .combobox {
  position: relative;
  max-width: 340px;
}
.combobox-input {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 7px 10px;
  font-size: 12px;
  width: 100%;
}
.combobox-input:focus { outline: none; border-color: var(--accent); }
.combobox-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  box-shadow: 0 8px 24px rgba(6, 16, 30, 0.5);
  z-index: 15;
}
.issue-modal-card .combobox-results {
  max-height: min(42vh, 360px);
}
.combobox-option {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--ink-dim);
  cursor: pointer;
}
.combobox-option:hover, .combobox-option.active { background: var(--paper); color: var(--ink); }
.combobox-empty {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--ink-faint);
  font-style: italic;
}
.dependency-violation-notice {
  margin-top: 8px;
  font-size: 12px;
  color: var(--amber);
  background: rgba(232, 163, 61, 0.1);
  border: 1px solid var(--amber);
  padding: 8px 10px;
}
.dependency-violation-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.dependency-violation-link:hover { color: var(--accent); }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 9px 14px;
  font-size: 12px;
}
.btn-secondary:hover { background: rgba(127, 209, 232, 0.1); }
.btn-danger {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-faint);
  padding: 9px 14px;
  font-size: 12px;
}
.btn-danger:hover { border-color: var(--red); color: var(--red); }
.save-indicator {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  margin-left: auto;
}



/* Markdown memo: the textarea is the source of truth; blur shows a safe preview. */
.memo-markdown-editor[hidden],
.memo-markdown-preview[hidden] {
  display: none !important;
}
.memo-markdown-preview {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  word-break: break-word;
  cursor: text;
}
.memo-markdown-preview:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.memo-markdown-preview > :first-child { margin-top: 0; }
.memo-markdown-preview > :last-child { margin-bottom: 0; }
.memo-markdown-preview p { margin: 0 0 9px; }
.memo-markdown-preview h1,
.memo-markdown-preview h2,
.memo-markdown-preview h3,
.memo-markdown-preview h4,
.memo-markdown-preview h5,
.memo-markdown-preview h6 {
  color: var(--ink);
  line-height: 1.35;
  margin: 14px 0 7px;
}
.memo-markdown-preview h1 { font-size: 19px; }
.memo-markdown-preview h2 { font-size: 17px; }
.memo-markdown-preview h3 { font-size: 15px; }
.memo-markdown-preview h4,
.memo-markdown-preview h5,
.memo-markdown-preview h6 { font-size: 13px; }
.memo-markdown-preview ul,
.memo-markdown-preview ol {
  margin: 5px 0 10px;
  padding-left: 24px;
}
.memo-markdown-preview li { margin: 2px 0; }
.memo-markdown-preview blockquote {
  margin: 8px 0;
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--rule);
  color: var(--ink-dim);
}
.memo-markdown-preview pre {
  max-width: 100%;
  overflow: auto;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  white-space: pre;
}
.memo-markdown-preview code {
  font-family: var(--font-mono);
  font-size: 0.92em;
}
.memo-markdown-preview a,
.memo-drive-open-link {
  color: var(--accent);
  text-decoration: underline;
  overflow-wrap: anywhere;
}
.memo-markdown-table {
  display: block;
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  overflow-x: auto;
  margin: 10px 0;
}
.memo-markdown-table th,
.memo-markdown-table td {
  padding: 6px 9px;
  border: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
  min-width: 72px;
}
.memo-markdown-table th { background: var(--paper); }
.memo-markdown-preview hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 12px 0;
}
.memo-markdown-empty { color: var(--ink-faint); }
.memo-drive-preview {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 10px 0;
}
.memo-drive-preview iframe {
  display: block;
  width: 100%;
  height: clamp(220px, 55vh, 480px);
  border: 1px solid var(--rule);
  background: var(--paper);
}
.memo-drive-open-link {
  display: inline-block;
  margin-top: 5px;
  font-size: 12px;
}
