/* ==========================================================================
   grip — ページ固有のレイアウト補助スタイル
   トークン・部品は css/style.css（web-designer作成・変更不可）をそのまま使う。
   ここは style.css に無い「実装上必要な最小限の組み合わせ」だけを足す。
   新しい色・フォントは一切定義しない（すべて var(--...) 経由）。
   ========================================================================== */

/* 見出し行＋操作を横並びにする共通レイアウト（セクションタイトルの右にボタン類） */
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}
.section-title-row .section-title { margin-bottom: 0; }

/* セグメント切替（期間ズーム・種別絞り込み） */
.seg {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  flex: none;
}
.seg-btn {
  min-height: 36px;
  min-width: 44px;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  background: var(--bg);
  color: var(--text-secondary);
  border: none;
  border-right: 1px solid var(--border-strong);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out-quint);
}
.seg-btn:last-child { border-right: none; }
.seg-btn:hover { background: var(--bg-tertiary); }
.seg-btn[aria-selected="true"] {
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 600;
}

/* フォーム: 幅に応じて2〜3カラムに流し込む */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0 var(--space-4);
  align-items: start;
}
.form-grid .field { margin-bottom: var(--space-3); }

/* ツリーの展開/折りたたみトグル（表内・タップ領域24px以上を確保） */
.tree-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: none;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-xs);
  transition: background-color var(--duration-fast) var(--ease-out-quint);
}
.tree-toggle:hover { background: var(--bg-quaternary); color: var(--text-secondary); }
.tree-toggle-blank { display: inline-block; width: 24px; height: 24px; flex: none; }
.row-title-wrap { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; }
.row-title-text { min-width: 0; overflow-wrap: anywhere; }
tr.is-collapsed-child { display: none; }
tr[data-depth] { cursor: pointer; }

/* 子項目の入れ子表示（詳細ページ・再帰） */
.nested-children { margin-top: var(--space-3); }
.nested-children .panel--nested + .nested-children { margin-left: var(--space-6); }

/* マイルストーン帯: 当たり判定を24px確保しつつ見た目は元の小さいドットのまま */
.milestone-hit {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.milestone-hit .milestone-marker { position: static; transform: none; }
.milestone-hit:focus-visible { outline-offset: 4px; }

/* 状態表示のちょっとした余白調整（追記フォーム内など） */
.field textarea#decisionBody { min-height: 88px; }

/* パンくず的な親リンク */
.parent-link { font-size: var(--text-sm); color: var(--text-tertiary); }
.parent-link a { color: var(--text-tertiary); text-decoration: underline; }
.parent-link a:hover { color: var(--accent); }

/* 添付プレビュー（アップロード前） */
.attachment-preview {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}
.attachment-preview img { max-width: 80px; max-height: 80px; border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* トップバーの戻るリンク */
.topbar a.btn { text-decoration: none; }

/* 種別タグ: flexコンテナ内で潰れて文字が2行に割れるのを防ぐ（style.cssには無い指定） */
.type-tag { white-space: nowrap; flex-shrink: 0; }

/* 横スクロールする表: 識別列（タイトル）を左端に固定する（style.cssのtable.gridに追加） */
.table-wrap table.grid td.cell-title,
.table-wrap table.grid th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--bg);
  border-right: 1px solid var(--border);
}
.table-wrap table.grid thead th:first-child { z-index: 2; background: var(--bg-secondary); }
.table-wrap table.grid tbody tr:hover td.cell-title { background: var(--bg-tertiary); }

/* トップバー: 狭い画面でログアウトボタンが折り返して文字が割れるのを防ぐ */
.topbar .who { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.topbar .btn, .topbar a.btn { white-space: nowrap; flex: none; }

@media (max-width: 640px) {
  .seg-btn { min-width: 0; padding: 0 var(--space-2); }
  .topbar .who { display: none; } /* 本人のメールアドレスなので狭い画面では省略してよい（設定等では出さない） */
  .table-meta { flex-wrap: wrap; }
  .table-meta input[type="search"] { max-width: none !important; width: 100%; }
}
