/* ==================================================
   1. ページ全体の基本スタイル・レイアウト
   ================================================== */

:root {
  --slot-scroll-max-height: calc(11 * 2.8rem);
  /* 全ページ共通の本文の最大幅(2026-09-26)。
     ページごとに幅がばらばらだったため、ここ1か所で決める。
     使う場所: .container / .container:has(> .mypage-layout) /
     .help-page / .shared-library-page > p など。
     表の最小幅も800px(.file-slot-table / .shared-pattern-table)。
     これより幅の広い表は、それぞれのスクロール枠
     (.data-editor-table-container など)の中で横スクロールする。 */
  --page-content-width: 800px;
}

/**
 * ページ全体（ルート要素）
 * 対象タグ: <body>
 * 用途: フォントセット、余白のリセット、全体背景色およびテキスト色の初期化
 */
body {
  font-family: sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f8f9fa;
  color: #333;
}

/**
 * ナビゲーションバー（ヘッダー）
 * 対象タグ: <nav> または <header> 内の <div class="navbar">
 * 用途: 画面上部に固定・配置するヘッダーバー（ロゴとログイン情報を左右に分散配置）
 */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #ffffff;
  padding: 1rem 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/**
 * ブランド名 / ロゴリンク
 * 対象タグ: <a> (例: <a class="brand" href="#">サービス名</a>)
 * 用途: ヘッダー左側のタイトル・ロゴ表示
 */
.brand {
  font-size: 1.25rem;
  font-weight: bold;
  text-decoration: none;
  color: #2c3e50;
}

/**
 * メインコンテンツコンテナ
 * 対象タグ: <main> または <div> (例: <div class="container">)
 * 用途: コンテンツ全体を中央寄せにし、最大幅を制限する標準ラッパー
 *       (幅は :root の --page-content-width で全ページ共通)
 */
.container {
  max-width: var(--page-content-width);
  margin: 2rem auto;
  padding: 0 1rem;
}

/**
 * ヒーローセクション (メインビジュアル/強調エリア)
 * 対象タグ: <section> または <div> (例: <div class="hero">)
 * 用途: トップページ等の最上部で強調メッセージや主要アクションを表示するカード
 */
.hero {
  text-align: center;
  padding: 2rem 1rem;
  background: #ffffff;
  border-radius: 8px;
  margin-bottom: 2rem;
}

/**
 * ヒーローセクションの画像(例: トップページの併願戦略サンプル画像)
 * 対象タグ: <img class="hero-image">
 * 用途: 画像を確実にブロック要素として独立した行に表示し、中央寄せする。
 * <img>は既定でinline要素のため、直前の要素の並び方によっては、
 * ログイン/新規登録ボタン(.button-group、display:flex)の隣に横並びで
 * 表示されてしまうことがある。display:blockにすることで、前後に
 * どんな要素があっても常にボタンの下の独立した行に表示されるようにする。
 * max-width/height:autoは、画像がスマホ幅の画面からはみ出さないための設定。
 */
.hero-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5rem auto 0;
}

/* ==================================================
   2. ボタン・アクション要素
   ================================================== */

/**
 * ボタン配置グループ
 * 対象タグ: <div> (例: <div class="button-group">)
 * 用途: 複数ボタンを横並び・中央寄せで配置するためのFlexコンテナ
 */
.button-group {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

/**
 * 基本ボタン要素
 * 対象タグ: <button> または <a> (例: <button class="btn">, <a class="btn">)
 * 用途: サイト内のすべてのボタンで共通利用するベース形状設定
 */
.btn {
  display: inline-block;
  padding: 0.5rem 1.2rem;
  border-radius: 4px;
  text-decoration: none;
  font-weight: bold;
  cursor: pointer;
}

/* 無効化されたボタン(例: 併願戦略シミュレーターの「1つ元に戻す」で、
   元に戻せる操作が無い間) - 対象要素: .btn:disabled */
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* プライマリボタン (主要操作・決定) - 対象要素: .btn.btn-primary */
.btn-primary {
  background-color: #007bff;
  color: white;
}

/* セカンダリボタン (キャンセル・補助操作) - 対象要素: .btn.btn-secondary */
.btn-secondary {
  background-color: #6c757d;
  color: white;
}

/* アウトラインボタン (枠線タイプ) - 対象要素: .btn.btn-outline */
.btn-outline {
  border: 1px solid #007bff;
  color: #007bff;
}

/* 大型ボタン - 対象要素: .btn.btn-large */
.btn-large {
  padding: 0.75rem 1.5rem;
  font-size: 1.1rem;
}

/* ブロック幅ボタン (幅100%) - 対象要素: .btn.btn-block */
.btn-block {
  width: 100%;
}

/* ==================================================
   3. カード・グリッド・フォーム・メッセージ
   ================================================== */

/**
 * 汎用グリッドコンテナ
 * 対象タグ: <div> (例: <div class="grid">)
 * 用途: 子要素（カード等）をレスポンシブに自動複数列配置するCSS Grid
 */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

/**
 * 汎用カード
 * 対象タグ: <div>, <article> (例: <div class="card">)
 * 用途: 枠線と角丸を持った標準コンテンツボックス
 */
.card {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

/**
 * 認証・ログイン/会員登録用カード
 * 対象タグ: <div>, <form> (例: <div class="auth-card">)
 * 用途: ログイン・新規登録画面の中央寄せ幅狭カード
 */
.auth-card {
  max-width: 400px;
  margin: 3rem auto;
  background: #ffffff;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/**
 * フォーム項目グループ
 * 対象タグ: <div> (例: <div class="form-group">)
 * 用途: ラベルと入力欄をワンセットにする垂直マージン確保ブロック
 */
.form-group {
  margin-bottom: 1.2rem;
}

/**
 * フォームのラベルテキスト
 * 対象タグ: <label> (例: <div class="form-group"><label>項目名</label></div>)
 * 用途: 入力項目の名前をブロック表示・太字化
 */
.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: bold;
}

/**
 * フォームのテキスト入力フィールド
 * 対象タグ: <input> (例: <input type="text">, <input type="email">)
 * 用途: 幅100%の標準角丸インプットボックス
 */
.form-group input {
  width: 100%;
  padding: 0.6rem;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/**
 * 会員登録の利用規約・プライバシーポリシー同意チェックボックス
 * 対象タグ: <div class="form-group form-group-checkbox">,
 *          <label class="checkbox-label"> (templates/register.html)
 * 用途: チェックボックスと同意文言(規約・ポリシーへのリンクを含む)を
 *       横並びにする、通常のform-group(幅100%のinput)とは異なる配置。
 */
.form-group-checkbox {
  margin-bottom: 1.2rem;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-weight: normal;
  font-size: 0.9rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 0.2rem;
  flex-shrink: 0;
  width: auto;
}

/**
 * 状態メッセージボックス
 * 対象タグ: <div>, <p> (例: <div class="message success">...</div>)
 * 用途: ユーザーへの通知や処理結果（情報/成功/エラー）の表示ボックス
 */
.message {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
}

/* 情報通知 (グレー) - 対象要素: .message.info */
.message.info {
  background-color: #e2e3e5;
  color: #383d41;
}

/* 成功メッセージ (緑) - 対象要素: .message.success */
.message.success {
  background-color: #d4edda;
  color: #155724;
}

/* エラーメッセージ (赤) - 対象要素: .message.error */
.message.error {
  background-color: #f8d7da;
  color: #721c24;
}

/**
 * 認証画面フッター案内領域
 * 対象タグ: <div>, <p> (例: <div class="auth-footer">)
 * 用途: 「アカウントをお持ちでない方はこちら」などのリンク注記エリア
 */
.auth-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.9rem;
}

/* ==================================================
   4. 共通データエディタ (Excel<->JSON、表/カード編集)
   ================================================== */

/**
 * ツールバー領域
 * 対象タグ: <div> (例: <div class="data-editor-toolbar">)
 * 用途: インポート/エクスポートボタンやファイル選択ボタンを横並びにするエリア
 */
.data-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}

/**
 * 隠しファイルインプット
 * 対象タグ: <input type="file">
 * 用途: カスタムUIボタンから起動するため標準の「ファイルを選択」要素を非表示化
 */
.data-editor-toolbar input[type="file"] {
  display: none;
}

/**
 * テーブル用スクロールコンテナ
 * 対象タグ: <div> (例: <div class="data-editor-table-container">)
 * 用途: 幅の広いテーブルが画面からはみ出る場合に横スクロール可能にする
 */
.data-editor-table-container {
  overflow-x: auto;
}

/**
 * ファイルスロット用の縦スクロール対応
 * 対象タグ: <div class="data-editor-table-container slot-scroll">
 * 用途: ファイル一覧テーブルが10行を超える場合に、最大高さを設定して
 *       縦スクロールを有効化する。CSS custom propertyで高さを指定。
 */
.data-editor-table-container.slot-scroll {
  max-height: var(--slot-scroll-max-height);
  overflow-y: auto;
}

/**
 * ファイル編集中の場合は、スクロール制限を無効化
 * 対象タグ: <div class="data-editor-table-container slot-scroll:has(#file-editor-row)">
 * 用途: インラインエディタが表示されている間は、スクロール制限を外して
 *       エディタを完全に表示できるようにする
 */
.data-editor-table-container.slot-scroll:has(#file-editor-row) {
  max-height: none;
  overflow-y: visible;
}

/**
 * スクロール有効時のテーブルヘッダー固定
 * 対象タグ: <th> (スクロール対応テーブルの見出しセル)
 * 用途: スクロールしても列見出しが常に画面上端に表示される
 */
.data-editor-table-container.slot-scroll .file-slot-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

/**
 * データ編集用メインテーブル
 * 対象タグ: <table> (例: <table class="data-editor-table">)
 * 用途: 行・列でデータを管理・編集する標準幅固定テーブル
 */
.data-editor-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  background: #ffffff;
}

/**
 * テーブルの見出しセル・データセル
 * 対象タグ: <th>, <td>
 * 用途: セルのパディング、境界線、テキスト折り返し設定
 */
.data-editor-table th,
.data-editor-table td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid #e0e0e0;
  text-align: left;
  overflow-wrap: break-word;
}

/* テーブル見出しセル背景 - 対象タグ: <th> */
.data-editor-table th {
  background-color: #f1f3f5;
}

/**
 * ファイルスロットテーブル (ファイル一覧用)
 * 対象タグ: <table class="file-slot-table">
 * 用途: アプリごとのExcel/JSONファイル管理用テーブル (幅800px以上固定)。
 *       偏差値表の生成・併願シミュレーション・SAPIXクラス実績・出願
 *       スケジュールの4ページで共通。列幅はここだけで決める
 *       (2026-09-26、各ページで幅をそろえるため 40%/15%/45% から変更)。
 *       width: 100% と table-layout: fixed は .data-editor-table と同じ値
 *       (file-slot-table 単独で使われても幅が崩れないよう明示している)。
 */
.file-slot-table {
  width: 100%;
  table-layout: fixed;
  min-width: 580px;
}

/* 各列の幅定義 - 対象タグ: <col>(各テンプレートの <colgroup>) */
.file-slot-table .col-filename {
  width: 30%;
} /* ファイル名列 */
.file-slot-table .col-updated {
  width: 15%;
} /* 更新日時列 */
.file-slot-table .col-actions {
  width: auto;
} /* 操作ボタン群列(残りの幅 = 60%) */

/**
 * データテーブル内のテキスト入力セル
 * 対象タグ: <input> (例: <td><input type="text"></td>)
 * 用途: テーブルセル内に隙間なくフィットする入力用テキストボックス
 */
.data-editor-table input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.3rem 0.4rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/**
 * 【レスポンシブ設定】スマホ画面(幅640px以下)でのテーブル構造切り替え
 * 対象タグ: <table>, <thead>, <tbody>, <tr>, <th>, <td>
 * 用途: 表形式(<table>)をカード型の縦並びレイアウトへ変換表示
 */
@media (max-width: 640px) {
  /* 表のヘッダー(thead)を隠す */
  .data-editor-table thead {
    display: none;
  }
  /* テーブル構成要素をすべてブロック化 */
  .data-editor-table,
  .data-editor-table tbody,
  .data-editor-table tr,
  .data-editor-table td {
    display: block;
    width: 100%;
  }
  /* 各データ行(tr)を1つのカードとして成形 */
  .data-editor-table tr {
    margin-bottom: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.5rem;
  }
  /* セル(td)をFlexボックスで横並び化 */
  .data-editor-table td {
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
  }
  /* HTMLのdata-label属性の値を参照し、疑似要素::beforeで左側にラベルを表示 */
  .data-editor-table td::before {
    content: attr(data-label);
    font-weight: bold;
    flex: 0 0 6.5rem;
    width: 6.5rem;
    box-sizing: border-box;
  }
  /* カード内のフォーム・入力要素の可変設定 */
  .data-editor-table td input,
  .data-editor-table td select,
  .data-editor-table td button {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
  }
  /* チェックボックスのみ固定幅化 */
  .data-editor-table td input[type="checkbox"] {
    flex: 0 0 auto;
    width: auto;
  }

  /**
   * ファイル行の操作ボタン(「JSON変換」「ダウンロード」「削除」、
   * 「表示・編集」「偏差値表の生成」/「併願戦略シミュレーター」「削除」
   * 「・・・」等。static/js/file_manager.js の .file-row-actions)は、
   * PC表示では横一列のままで良いが、スマホ表示でそのまま横に並べると
   * 窮屈に詰まってしまうため、縦一列(1ボタン1行、幅いっぱい)に積み替える。
   */
  .file-slot-table .file-row-actions {
    flex-direction: column;
    align-items: stretch;
  }
  /* 「操作」ラベル(::beforeで表示)は、横並び用の固定幅(6.5rem)を
     縦並びでは高さとして解釈されてしまう(flexの主軸が変わるため)ので、
     ラベル自体の幅・高さを内容に合わせて自動化する */
  .file-slot-table .file-row-actions::before {
    flex: 0 0 auto;
    width: auto;
    margin-bottom: 0.3rem;
  }
  .file-slot-table .file-row-actions button {
    flex: 0 0 auto;
    width: 100%;
  }
  /* PC用の最小幅(800px)を外し、カード形式の表を画面幅に収める
     (2026-09-26。外さないと、スマホでカードが横にはみ出す) */
  .file-slot-table {
    min-width: 0;
  }
}

/* ==================================================
   5. マイページレイアウト & インラインエディタ
   ================================================== */

/**
 * ログインユーザー情報エリア
 * 対象タグ: <div> (例: <div class="auth-nav">)
 * 用途: ヘッダー右側にユーザーメールアドレスやメニューを表示
 */
.auth-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ユーザーメールアドレス表示テキスト - 対象タグ: <span>, <p> */
.nav-user-email {
  color: #6c757d;
  font-size: 0.9rem;
}

/* ファイルカード内のフォームマージン調整 - 対象クラス: .file-card .form-group */
.file-card .form-group {
  margin-bottom: 0.8rem;
}

/* ファイルカード内のセレクトボックス - 対象タグ: <select> */
.file-card select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}

/* ファイルカード内のボタン群位置指定 - 対象クラス: .file-card .button-group */
.file-card .button-group {
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/**
 * マイページ用幅広コンテナ拡張
 * 対象要素: .container の直下に .mypage-layout が存在する場合
 * 用途: 左サイドバー(220px)と間隔(2rem)の分だけ広げ、右側の本文
 *       (.mypage-main)の幅を、他のページと同じ --page-content-width にする
 */
.container:has(> .mypage-layout) {
  max-width: calc(var(--page-content-width) + 220px + 2rem);
}

/**
 * マイページ全体レイアウト
 * 対象タグ: <div> (例: <div class="mypage-layout">)
 * 用途: 左サイドバーと右メイン領域の2カラムFlex配置
 */
.mypage-layout {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
}

/**
 * マイページ左サイドバー
 * 対象タグ: <aside>, <div> (例: <div class="mypage-sidebar">)
 * 用途: 画面スクロール時も上部に固定追従(sticky)する幅220pxのナビゲーションパネル
 */
.mypage-sidebar {
  flex: 0 0 220px;
  position: sticky;
  top: 1rem;
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1rem;
  box-sizing: border-box;
}

/* サイドバーの見出し - 対象タグ: <h2> */
.mypage-sidebar h2 {
  font-size: 1rem;
  margin-top: 0;
  margin-bottom: 0.75rem;
}

/* アプリケーション一覧リスト - 対象タグ: <ul> */
.app-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* アプリケーション一覧の項目 - 対象タグ: <li> */
.app-list li {
  margin-bottom: 0.8rem;
}

/* アプリケーションリンク - 対象タグ: <a> */
.app-list a {
  color: #007bff;
  text-decoration: none;
  font-weight: bold;
}

.app-list a:hover {
  text-decoration: underline;
}

/**
 * マイページメイン表示領域
 * 対象タグ: <main>, <div> (例: <div class="mypage-main">)
 * 用途: サイドバー以外の残りの幅一杯に広がるコンテンツ表示部
 */
.mypage-main {
  flex: 1;
  min-width: 0;
}

/**
 * アプリ別ファイル管理セクション
 * 対象タグ: <section>, <div> (例: <div class="app-file-section">)
 * 用途: 各アプリプログラムごとのファイル管理パネル
 */
.app-file-section {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  scroll-margin-top: 1rem;
}

/* セクションタイトル - 対象タグ: <h2> */
.app-file-section h2 {
  margin-top: 0;
  font-size: 1.1rem;
  color: #2c3e50;
}

/* テーブル上の小見出し - 対象要素: .app-file-table-heading */
.app-file-table-heading {
  font-size: 0.95rem;
  color: #2c3e50;
  margin: 1rem 0 0.4rem;
}

/* 表の見出しの下の補足説明(併願シミュレーションの「シミュレーション」の表。
   2026-09-26) - 対象要素: .app-file-table-note */
.app-file-table-note {
  margin: 0 0 0.5rem 0;
  color: #6c757d;
  font-size: 0.85rem;
}

/* ファイル行の操作ボタン配置 - 対象要素: .file-row-actions */
.file-slot-table .file-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* ファイル未登録時（空行）のスタイル - 対象要素: .file-row-empty td */
.file-slot-table .file-row-empty td {
  color: #adb5bd;
}

/**
 * 「その他の操作」ハンバーガー/ドットアイコンボタン
 * 対象タグ: <button class="file-row-more-btn">
 * 用途: テキストなし・アイコン1つの小サイズボタン
 */
.file-row-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-left: 0.7rem;
  padding-right: 0.7rem;
}

/* ボタン内のアイコン画像 - 対象タグ: <img> */
.file-row-more-icon {
  height: 25px;
  width: auto;
  display: block;
}

/**
 * ポップアップ/コンテキストメニュー
 * 対象タグ: <div> (例: <div class="context-menu">)
 * 用途: document.body 直下に動的生成されるドロップダウン型操作メニュー (position: fixed)
 */
.context-menu {
  position: fixed;
  z-index: 1000;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  min-width: 200px;
  overflow: hidden;
  padding: 0.3rem 0;
}

/* メニュー項目ボタン - 対象タグ: <button class="context-menu-item"> */
.context-menu-item {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
  color: #2c3e50;
}

.context-menu-item:hover {
  background-color: #f1f3f5;
}

/* 編集可能テキストヒント (インライン名変更) - 対象要素: .file-name-editable */
.file-slot-table .file-name-editable {
  cursor: pointer;
}
.file-slot-table .file-name-editable:hover {
  text-decoration: underline dotted;
}

/**
 * インラインエディタ挿入用テーブル行
 * 対象タグ: <tr id="file-editor-row"> > <td>
 * 用途: ファイル一覧表の行直下に挿入される編集領域用セルの初期化
 */
#file-editor-row > td {
  padding: 0;
  border: none;
}

/**
 * インラインエディタ本体パネル
 * 対象タグ: <div> (例: <div id="file-editor-section">)
 * 用途: ファイルのデータを表内で直接編集するための展開枠
 */
#file-editor-section {
  margin: 0.5rem 0;
  padding: 1rem;
  background: #f8f9fa;
  border: 1px dashed #ccc;
  border-radius: 8px;
  text-align: left;
}

/* エディタ上部フィールドコンテナ - 対象要素: .editor-header-fields */
.editor-header-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.editor-header-fields .form-group {
  flex: 1 1 200px;
  margin-bottom: 0;
}

/* エディタ表示中のファイル名タイトル - 対象要素: .file-editor-filename */
.file-editor-filename {
  font-weight: bold;
  color: #2c3e50;
}

/* テーブル内の行操作ボタン（追加・削除など） - 対象要素: .data-editor-table .row-actions */
.data-editor-table .row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* データゼロ時の「行を追加」ボタン - 対象要素: .editor-add-first-row-btn */
.editor-add-first-row-btn {
  margin-top: 0.75rem;
}

/* 【レスポンシブ設定】マイページの縦並び化 (640px以下) */
@media (max-width: 640px) {
  .mypage-layout {
    flex-direction: column;
  }
  .mypage-sidebar {
    flex: none;
    width: 100%;
    position: static;
  }
}

/* ==================================================
   6. 偏差値表生成画面
   ================================================== */

/* サブタイトルテキスト - 対象要素: .deviation-subtitle */
.deviation-subtitle {
  color: #6c757d;
  margin-top: -0.5rem;
}

/* サマリー（概要）表示エリア - 対象要素: .deviation-summary */
.deviation-summary {
  margin-bottom: 1rem;
}

.deviation-summary p {
  margin: 0.3rem 0;
}

/* 編集注記ヒントテキスト - 対象要素: .deviation-edit-hint */
.deviation-edit-hint {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: #6c757d;
}

/* ==================================================
   7. 汎用モーダルダイアログ (共有投稿フォーム等)
   ================================================== */

/**
 * モーダルオーバーレイ背景
 * 対象タグ: <div> (例: <div class="modal-overlay">)
 * 用途: 画面全体を覆い、背景を暗くしてダイアログを強調する半透明マスク
 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 2000;
}

/**
 * モーダルコンテンツウィンドウ
 * 対象タグ: <div> (例: <div class="modal">)
 * 用途: ポップアップダイアログ本体の白枠・影付きボックス
 */
.modal {
  background: #ffffff;
  border-radius: 8px;
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

/* モーダル見出し - 対象タグ: <h3> */
.modal h3 {
  margin-top: 0;
}

/**
 * モーダル内長文テキスト入力欄
 * 対象タグ: <textarea> (例: <div class="form-group"><textarea></textarea></div>)
 * 用途: 説明文やメモを入力するための可変テキストエリア
 */
.form-group textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: inherit;
  resize: vertical;
}

/* 共有ダイアログの注釈 - 対象要素: .share-dialog-note */
.share-dialog-note {
  font-size: 0.85rem;
  color: #6c757d;
}

/* 学校マスターデータの非保証に関する注意書き(利用規約 第12条の2)。
   「学校マスターから選ぶ」モーダル・併願シミュレーション画面・
   全画面ツリー編集画面で共通して使う、小さめの控えめな注釈スタイル。
   対象要素: .disclaimer-note */
.disclaimer-note {
  display: block;
  font-size: 0.75rem;
  color: #868e96;
  margin-top: 6px;
}

/**
 * 「学校マスターから選ぶ」モーダルの絞り込みトグルボタン群
 * (学校種別・所在地・試験日)。2026-09-18、学校マスターが295校まで
 * 増えたことへの対応として追加。
 * 対象要素: .school-master-filter-group / .filter-group-label /
 *           .filter-toggle-row
 */
.school-master-filter-group {
  margin-bottom: 0.75rem;
}

.filter-group-label {
  display: block;
  font-size: 0.85rem;
  font-weight: bold;
  margin-bottom: 4px;
}

.filter-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* 既定(非選択)の見た目。以前は .btn-outline(白背景+青枠+青文字)を
   使っていたが、選択中(青塗り)との差がわかりにくいという指摘
   (2026-09-18)を受け、非選択時ははっきりしたグレー系の塗りに変更した。
   「押されている/いない」がひと目でわかることを優先している。 */
.filter-toggle-row .btn {
  padding: 0.25rem 0.7rem;
  font-size: 0.85rem;
  font-weight: normal;
  background-color: #e9ecef;
  color: #495057;
  border: 1px solid #ced4da;
}

/* 選択中(絞り込み対象に含まれている)トグルボタン。表示モード切替
   ボタン(.apply-view-toggle .btn.active)と同じ配色に揃えている。 */
.filter-toggle-row .btn.active {
  background-color: #007bff;
  color: white;
  border-color: #007bff;
  font-weight: bold;
}

/**
 * 学校リンク集ページ(/mypage/info_school_links)左カラム(共通メニュー)の
 * 非登録ユーザー向け非表示制御。
 * 作成日: 2026-09-18
 *
 * 経緯: 学校リンク集は非登録ユーザーにも公開するが、左カラムの共通メニュー
 * (menu.html。マイページの各機能・ファイル管理へのリンクを含む)は登録
 * ユーザーのみに表示してほしいという要望を受けた対応。ログイン状態は
 * サーバー側では分からない(このアプリはCookieセッションを持たず、
 * localStorageのアクセストークンのみで管理している)ため、まずこのクラスで
 * 非表示にしておき、static/js/school_links.js側でトークンがあればこの
 * クラスを外して表示する、という「既定では非表示」の安全側の作りにしている。
 * 対象要素: #school-links-sidebar (info_school_links.html)
 */
.school-links-sidebar-guest {
  display: none;
}

/**
 * 学校リンク集ページ(/mypage/info_school_links)の一覧テーブル。
 * 作成日: 2026-09-18(2026-09-19再更新: 募集要項ページ・PDFの2列構成を
 * 取りやめ、募集要項リンクが1列に戻ったことに合わせて幅を戻した)
 * 対象要素: .school-links-table / .link-pending
 */
.school-links-table .col-school-name {
  width: 24%;
}
.school-links-table .col-region {
  width: 12%;
}
.school-links-table .col-gender {
  width: 12%;
}
.school-links-table .col-link {
  width: 26%;
}

/* 一覧の行数が多いため、リンクボタンはトグルボタンと同程度のコンパクト
   な大きさにする(既定の.btnサイズだと295行の一覧では大きすぎるため)。 */
.school-links-table .btn {
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
}

/* 公式サイト・募集要項のURLが未収集の学校に表示するプレースホルダー */
.link-pending {
  color: #adb5bd;
  font-size: 0.85rem;
}

/**
 * 読み取り専用メモ表示ボックス
 * 対象タグ: <div> (例: <div class="memo-readonly-box">)
 * 用途: 入力欄ではなく確認用テキストであることを示す薄グレー背景ボックス
 */
.memo-readonly-box {
  background-color: #f1f3f5;
  border-radius: 4px;
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
  white-space: pre-wrap;
  min-height: 1.2em;
  color: #495057;
}

/* 空状態の時のプレースホルダー表示 */
.memo-readonly-box:empty::before {
  content: "(未入力)";
  color: #adb5bd;
}

/* モーダルフッターの操作ボタン群 (右寄せ) - 対象要素: .modal-actions */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* シミュレーションの保存数が上限のときの、破棄するファイルを選ぶウィンドウ
   (2026-09-26新設。static/js/simulation_discard_picker.js) */
.discard-picker-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 50vh;
  overflow-y: auto;
  margin: 0.75rem 0;
}

.discard-picker-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.6rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  cursor: pointer;
}

.discard-picker-item:hover {
  background: #f8f9fa;
}

.discard-picker-name {
  font-weight: bold;
  overflow-wrap: anywhere;
}

.discard-picker-date {
  color: #6c757d;
  font-size: 0.85rem;
}

/* ==================================================
   8. 共有ライブラリ画面
   ================================================== */

/* ライブラリ説明段落 - 対象要素: .shared-library-page > p */
.shared-library-page > p {
  color: #495057;
  max-width: var(--page-content-width);
}

/* パンくずリストナビゲーション - 対象要素: .shared-library-breadcrumb */
.shared-library-breadcrumb {
  font-size: 0.85rem;
  color: #6c757d;
}
.shared-library-breadcrumb a {
  color: #007bff;
  text-decoration: none;
}
.shared-library-breadcrumb a:hover {
  text-decoration: underline;
}

/* セーフティ・ガードライン注記 - 対象要素: .shared-library-guardrail-note */
.shared-library-guardrail-note {
  font-size: 0.85rem;
  color: #6c757d;
  max-width: var(--page-content-width);
}

/**
 * アプリ選択用カードリンク
 * 対象タグ: <a> (例: <a class="shared-library-app-card">)
 * 用途: カード全体をクリック可能にしたリンク要素
 */
.shared-library-app-card {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: box-shadow 0.15s ease;
}
.shared-library-app-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.shared-library-app-card h3 {
  margin-top: 0;
  color: #2c3e50;
}
.shared-library-app-card p {
  margin-bottom: 0;
  color: #6c757d;
}

/* 共有パターンカード配置用グリッド - 対象要素: .shared-pattern-grid */
.shared-pattern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

/**
 * 共有パターンカード
 * 対象タグ: <div>, <article> (例: <div class="shared-pattern-card">)
 * 用途: 共有されたデータパターンをカード形式で一覧表示するボックス
 */
.shared-pattern-card {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* カード内タイトル行 - 対象要素: .shared-pattern-card-title-row */
.shared-pattern-card-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.shared-pattern-card-title-row h3 {
  margin: 0;
  font-size: 1.05rem;
  color: #2c3e50;
}

/**
 * 公式・検証済みバッジ
 * 対象タグ: <span> (例: <span class="verified-badge">検証済</span>)
 * 用途: 緑色の角丸ピル型確認バッジ
 */
.verified-badge {
  display: inline-block;
  background-color: #d4edda;
  color: #155724;
  font-size: 0.75rem;
  font-weight: bold;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

/**
 * 投稿元ファイル種別バッジ(偏差値表の生成用のみ)
 * 対象タグ: <span class="source-kind-badge source-kind-xlsx">
 *          <span class="source-kind-badge source-kind-json">
 * 用途: 共有ライブラリの投稿が、Excelファイル由来かJSONファイル由来かを
 *       区別する角丸ピル型バッジ(static/js/shared_library.js参照)
 */
.source-kind-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: bold;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}
.source-kind-badge.source-kind-xlsx {
  background-color: #e2f0fb;
  color: #0c5488;
}
.source-kind-badge.source-kind-json {
  background-color: #f1eefc;
  color: #4b3a91;
}

/* 投稿者・投稿日時等のメタ情報 - 対象要素: .shared-pattern-card-meta */
.shared-pattern-card-meta {
  margin: 0;
  font-size: 0.85rem;
  color: #6c757d;
}

/* パターン説明文章 (改行維持) - 対象要素: .shared-pattern-card-description */
.shared-pattern-card-description {
  margin: 0;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

/* カード下部のアクション領域 - 対象要素: .shared-pattern-card-actions */
.shared-pattern-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

/* ==================================================
   9. 共有ライブラリ: 併願シミュレーション用の一覧表 (表形式)
   ================================================== */

/* 共有パターン用スクロールコンテナ - 対象要素: .shared-pattern-table-container */
.shared-pattern-table-container {
  overflow-x: auto;
  margin-top: 1.5rem;
}

/**
 * 共有パターン一覧表
 * 対象タグ: <table class="shared-pattern-table">
 * 用途: 併願パターン一覧を表形式で表示するテーブル (最小幅800px)
 */
.shared-pattern-table {
  width: 100%;
  min-width: 800px;
  border-collapse: collapse;
  background: #ffffff;
}

.shared-pattern-table th,
.shared-pattern-table td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid #e0e0e0;
  text-align: left;
  vertical-align: top;
}

.shared-pattern-table th {
  background-color: #f1f3f5;
  white-space: nowrap;
}

/* テーブルセル内要素レイアウト */
.shared-pattern-table-name {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
}

/* 高評価・投票用ボタンブロック - 対象要素: .shared-pattern-table-votes */
.shared-pattern-table-votes {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.shared-pattern-table-votes .btn {
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
}

/* タグ配置用コンテナ - 対象要素: .shared-pattern-table-tags */
.shared-pattern-table-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  max-width: 260px;
}

/**
 * 検索・分類用タグチップ
 * 対象タグ: <span> (例: <span class="tag-chip">共学</span>)
 * 用途: グレーの丸角小型タグバッジ
 */
.tag-chip {
  display: inline-block;
  background-color: #e9ecef;
  color: #495057;
  font-size: 0.8rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}

/* 操作列レイアウト - 対象要素: .shared-pattern-table-actions */
.shared-pattern-table-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
}

/* 【レスポンシブ設定】共有パターンテーブルのカード表示切り替え (640px以下) */
@media (max-width: 640px) {
  .shared-pattern-table thead {
    display: none;
  }
  .shared-pattern-table,
  .shared-pattern-table tbody,
  .shared-pattern-table tr,
  .shared-pattern-table td {
    display: block;
    width: 100%;
  }
  .shared-pattern-table {
    min-width: 0;
  }
  .shared-pattern-table tr {
    margin-bottom: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.5rem;
  }
  .shared-pattern-table td {
    border: none;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.4rem 0;
  }
  .shared-pattern-table td::before {
    content: attr(data-label);
    font-weight: bold;
    flex: 0 0 6.5rem;
    width: 6.5rem;
    box-sizing: border-box;
  }
}

/* ==================================================
   10. 併願シミュレーション: ツリー表示 (エディタ)
   ================================================== */

/**
 * 表示モード切替ボタン群
 * 対象タグ: <div> (例: <div class="apply-view-toggle">)
 * 用途: リスト表示/ツリー表示などを切り替えるボタン配置
 */
.apply-view-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex: 1 1 100%;
}

/* 選択中（アクティブ）の表示切替ボタン */
.apply-view-toggle .btn.active {
  background-color: #007bff;
  color: white;
}

/**
 * ツリー構造エディタコンテナ
 * 対象タグ: <div> (例: <div class="tree-editor-container">)
 * 用途: ツリー図を表示する外枠コンテナ
 */
.tree-editor-container {
  margin-top: 0.5rem;
}

/**
 * ツリー表示エリアスクロール枠
 * 対象タグ: <div> (例: <div class="tree-editor-scroll">)
 * 用途: 大きなツリーを表示する際の縦横スクロール可能領域。
 * 高さに上限(max-height)を設けているのは、この内側で実際にスクロールが
 * 発生するようにするため。position:sticky によるタイトル行・タイトル列の
 * 固定(下記 .tree-editor-panes 系クラス、エクセルの「ウィンドウ枠の固定」
 * 相当)は、sticky指定した要素の直近の「スクロールする祖先要素」が
 * 実際にスクロールしないと効果が出ない(高さの上限が無く、常に中身の
 * 高さ分だけ広がるだけの要素の場合、スクロール自体が発生しないため)。
 */
.tree-editor-scroll {
  overflow: auto;
  max-width: 100%;
  max-height: calc(100vh - 220px);
  min-height: 320px;
  border: 1px solid #c0c0c0;
  border-radius: 4px;
  background: #fafafa;
}

/**
 * ツリーエディタのタイトル行・タイトル列固定レイアウト
 * 対象タグ: <div class="tree-editor-panes"> とその子の4つの<svg>
 * 用途: 左上の余白・列ヘッダー(日付/時限)・行ヘッダー(行番号)・
 * 本体グリッドをそれぞれ独立した<svg>として描画し、CSS Gridで
 * 2行2列に配置したうえで、左上/列ヘッダー/行ヘッダーにposition:stickyを
 * 適用することで、.tree-editor-scroll 内をスクロールしても列ヘッダーは
 * 上端に、行ヘッダーは左端に、左上の余白は両方に固定表示され続けるように
 * している(エクセルの「ウィンドウ枠の固定」と同じ見た目・操作感)。
 * 60px・55px は static/js/tree_editor.js の ROW_HEADER_WIDTH /
 * HEADER_HEIGHT と一致させること(ずれると見出しと本体の境目がずれる)。
 */
.tree-editor-panes {
  display: grid;
  grid-template-columns: 60px max-content;
  grid-template-rows: 55px max-content;
  width: max-content;
}
.tree-editor-pane-corner,
.tree-editor-pane-col-header,
.tree-editor-pane-row-header,
.tree-editor-pane-main {
  display: block;
}
.tree-editor-pane-corner {
  grid-column: 1;
  grid-row: 1;
  position: sticky;
  top: 0;
  left: 0;
  z-index: 3;
}
.tree-editor-pane-col-header {
  grid-column: 2;
  grid-row: 1;
  position: sticky;
  top: 0;
  z-index: 2;
}
.tree-editor-pane-row-header {
  grid-column: 1;
  grid-row: 2;
  position: sticky;
  left: 0;
  z-index: 2;
}
.tree-editor-pane-main {
  grid-column: 2;
  grid-row: 2;
  z-index: 1;
}

/* ツリーエディタの操作ヒント注記 - 対象要素: .tree-editor-note */
.tree-editor-note {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #555;
}

/* ツリー構造のエラー表示 - 対象要素: .tree-editor-error */
.tree-editor-error {
  color: #721c24;
}

/**
 * ドラッグ＆ドロップ用ツリーノード要素
 * 対象タグ: <div>, <g> (SVGノード要素等)
 * 用途: マウスで掴んで移動可能なツリーの各節点要素
 */
.tree-node {
  cursor: grab;
}

/* ドラッグ実行中のツリーノード */
.tree-node.dragging {
  cursor: grabbing;
}

/* 追加可能マス(プロット操作でクリックできるマス)のホバー時強調 - 対象要素: .tree-slot-highlight:hover */
.tree-slot-highlight:hover {
  fill-opacity: 0.55;
}

/**
 * 候補校選択ダイアログ(黄色いマスのクリックで開く)
 * 対象タグ: <div class="tree-editor-picker-overlay"> > <div class="tree-editor-picker">
 * 用途: プロット操作(黄色いマスのクリック)時に表示する候補選択モーダル。
 *       合否分岐確定ダイアログ(.tree-branch-dialog-*)と統一感を持たせた
 *       オーバーレイ+中央カード形式。
 */
.tree-editor-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* ダイアログ本体 - 対象要素: .tree-editor-picker */
.tree-editor-picker {
  background: white;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  box-sizing: border-box;
}

/* ダイアログ見出し - 対象要素: .tree-editor-picker-title */
.tree-editor-picker-title {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

/* 候補一覧のスクロール枠 - 対象要素: .tree-editor-picker-list */
.tree-editor-picker-list {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  max-height: 50vh;
  overflow-y: auto;
}

/* 候補項目ボタン - 対象タグ: <button class="tree-editor-picker-item"> */
.tree-editor-picker-item {
  display: block;
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: none;
  border-bottom: 1px solid #eee;
  background: none;
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
  color: #2c3e50;
}

.tree-editor-picker-item:last-child {
  border-bottom: none;
}

.tree-editor-picker-item:hover {
  background-color: #f1f3f5;
}

/* ダイアログ下部のボタン行 - 対象要素: .tree-editor-picker-actions */
.tree-editor-picker-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

/**
 * 合否分岐確定ダイアログ(判定ノードのダブルクリックで開く)
 * 対象タグ: <div class="tree-branch-dialog-overlay"> > <div class="tree-branch-dialog">
 * 用途: gui/dialogs.py の DecisionBranchDialog 相当。画面中央に
 *       オーバーレイ表示し、「合格だった時」「不合格だった時」それぞれの
 *       後続の併願校をラジオボタンで選ばせる。
 */
.tree-branch-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* ダイアログ本体 - 対象要素: .tree-branch-dialog */
.tree-branch-dialog {
  background: white;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  box-sizing: border-box;
}

/* ダイアログ見出し - 対象要素: .tree-branch-dialog-title */
.tree-branch-dialog-title {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

/* 現在の状況(合格済み校・合格発表待ち)表示 - 対象要素: .tree-branch-dialog-status */
.tree-branch-dialog-status {
  font-size: 0.95rem;
  color: #555;
  margin: 0 0 1rem;
  white-space: pre-line;
}

/* 「合格だった時」「不合格だった時」の2カラムレイアウト - 対象要素: .tree-branch-dialog-columns */
.tree-branch-dialog-columns {
  display: flex;
  gap: 3.5rem;
  flex-wrap: wrap;
}

/* 各カラムのラッパー - 対象要素: .tree-branch-dialog-column-wrap */
.tree-branch-dialog-column-wrap {
  flex: 1 1 260px;
  min-width: 0;
}

/* カラム見出し(合格/不合格) - 対象要素: .tree-branch-dialog-column-label */
.tree-branch-dialog-column-label {
  font-weight: bold;
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
}

/* 合格側の見出し色 - 対象要素: .tree-branch-label-pass */
.tree-branch-label-pass {
  color: #2e7d32;
}

/* 不合格側の見出し色 - 対象要素: .tree-branch-label-fail */
.tree-branch-label-fail {
  color: #c62828;
}

/* 候補一覧のスクロール枠 - 対象要素: .tree-branch-list */
.tree-branch-list {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  max-height: 260px;
  overflow-y: auto;
}

/* スロット見出し行(--- 2/1 AM ---相当) - 対象要素: .tree-branch-list-header */
.tree-branch-list-header {
  padding: 0.3rem 0.6rem;
  background: #f0f0f0;
  font-size: 0.8rem;
  color: #555;
}

/* 候補項目(ラジオボタン+ラベル) - 対象タグ: <label class="tree-branch-list-item"> */
.tree-branch-list-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.tree-branch-list-item:hover {
  background-color: #f1f3f5;
}

/* 「受験しない」項目の文字色 - 対象要素: .tree-branch-item-skip */
.tree-branch-item-skip span {
  color: #ff0000;
  font-weight: bold;
}

/* 「受験を終了する」項目の文字色 - 対象要素: .tree-branch-item-finish */
.tree-branch-item-finish span {
  color: #0000ff;
  font-weight: bold;
}

/* ダイアログ下部のボタン行 - 対象要素: .tree-branch-dialog-actions */
.tree-branch-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* 「プロット」確定ボタン - 対象タグ: <button class="tree-branch-plot-btn"> */
.tree-branch-plot-btn {
  font-weight: bold;
}

/**
 * 併願戦略シミュレーター: ツリー表示専用の全画面ウィンドウ
 * 対象タグ: <div class="tree-fullscreen-toolbar">
 * 用途: templates/mypage/tree_fullscreen.html (window.open で開く別ウィンドウ)
 *       の上部ツールバー(保存ボタン・PDF出力ボタン・ファイル名を表示)。マイページ本体の
 *       ナビゲーションバー(.navbar)は持たない、素の全画面レイアウト。
 */
.tree-fullscreen-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: #ffffff;
  border-bottom: 1px solid #dee2e6;
  position: sticky;
  top: 0;
  z-index: 10;
}

/* ツリー表示専用ウィンドウのファイル名表示 - 対象要素: .tree-fullscreen-title */
.tree-fullscreen-title {
  font-weight: bold;
  color: #2c3e50;
}

/* ツリー表示専用ウィンドウの本文余白 - 対象要素: .tree-fullscreen-main */
.tree-fullscreen-main {
  padding: 0.5rem 1rem 1.5rem;
}

/* ==================================================
   11. index.html
   ================================================== */
h2.LP {
  text-align: left;
  margin-bottom: 0.25rem;
  padding: 0.25rem;
  border-left: 10px solid;
  color: #4d4d4d;
  font-weight: bold;
  font-size: 24px;
  background-color: #efefef;
}

h3.LP {
  text-align: left;
  margin-bottom: 0.25rem;
  padding: 0.25rem;

  color: #4d4d4d;
  font-weight: bold;
  font-size: 18px;
}

p.LP {
  text-align: left;
}

/* ==================================================
   12. マイページ: 使い方・周知事項ページ
   対象タグ: <div class="help-page"> (templates/mypage/help_*.html,
             templates/mypage/notices.html)
   用途: 全ユーザーに同じ内容を表示する静的な案内ページの、読みやすい
         最大幅・見出し余白・表への戻りリンクの共通スタイル。
   ================================================== */
.help-page {
  max-width: var(--page-content-width);
}

.help-page h2 {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.help-page h2:first-of-type {
  margin-top: 1rem;
}

.help-page ol,
.help-page ul {
  padding-left: 1.5rem;
}

.help-page li {
  margin-bottom: 0.4rem;
}

.help-page .back-link {
  display: inline-block;
  margin-top: 2rem;
}

/* 今後、周知事項を追加する際の1件分の区切り
   (templates/mypage/notices.html のコメント内の例を参照) */
.notice-item {
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #e0e0e0;
}

/**
 * 「アプリの説明」ページの、アプリ1件分の案内カード
 * 対象タグ: <div class="card app-intro-card"> (templates/mypage/index.html)
 * 用途: アイコン画像・見出し・説明文・リンクボタンをひとまとまりにした、
 *       アプリ紹介カード同士の縦の余白と、見出し内アイコンの位置調整。
 */
.app-intro-card {
  margin-bottom: 1.5rem;
}

.app-intro-card h2 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0;
}

.app-intro-card p .btn {
  margin-right: 0.5rem;
}

/**
 * ファイルスロット用の縦スクロール対応
 * 対象タグ: <div class="data-editor-table-container slot-scroll">
 * 用途: ファイル一覧テーブルが10行を超える場合に、最大高さを設定して
 *       縦スクロールを有効化する。CSS custom propertyで高さを指定。
 */
.data-editor-table-container.slot-scroll {
  max-height: var(--slot-scroll-max-height);
  overflow-y: auto;
}

/**
 * ファイル編集中の場合は、スクロール制限を無効化
 * 対象タグ: <div class="data-editor-table-container slot-scroll:has(#file-editor-row)">
 * 用途: インラインエディタが表示されている間は、スクロール制限を外して
 *       エディタを完全に表示できるようにする
 */
.data-editor-table-container.slot-scroll:has(#file-editor-row) {
  max-height: none;
  overflow-y: visible;
}

/**
 * スクロール有効時のテーブルヘッダー固定
 * 対象タグ: <th> (スクロール対応テーブルの見出しセル)
 * 用途: スクロールしても列見出しが常に画面上端に表示される
 */
.data-editor-table-container.slot-scroll .file-slot-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

/**
 * SAPIXクラス実績: サマリー(概要)表示エリア
 * 対象要素: .sapix-summary (.deviation-summaryと同じ考え方)
 */
.sapix-summary {
  margin-bottom: 1rem;
}

.sapix-summary p {
  margin: 0.3rem 0;
}

/**
 * SAPIXクラス実績: テストごとのグラフカード
 * 対象要素: .sapix-test-card (templates/sapix_generate_course_division/index.html)
 * 用途: 正規分布グラフ(Canvas)を1テストずつカード表示する際の余白
 */
.sapix-test-card {
  margin-bottom: 1.2rem;
}

.sapix-test-card h3 {
  margin-top: 0;
}

/**
 * SAPIXクラス実績: 正規分布グラフを描画するCanvas
 * 対象タグ: <canvas class="sapix-chart-canvas">
 * 用途: 画面幅に応じて縮小表示できるようにする(縦横比は維持)
 */
.sapix-chart-canvas {
  max-width: 100%;
  height: auto;
  display: block;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
}

/* ===================================================================
   出願スケジュールのガントチャート(2026-09-26新設。
   static/js/application_payment_gantt.js が作る操作パネル・グラフ)
   =================================================================== */
/* 出願スケジュールの閲覧画面(templates/generate_application_payment_schedule/
   index.html)だけ、本文の最大幅(--page-content-width)を外して、画面の横幅
   いっぱいに表示する(2026-09-26。ガントチャートを広く見せるため)。
   左右の余白(.container の padding)はそのまま残す。 */
.container:has(> .schedule-page) {
  max-width: none;
}

.gantt-container {
  margin: 0 0 1.5rem 0;
}

/* 出願・入金スケジュールの進捗状況の画面(2026-09-26新設。
   static/js/application_payment_progress_view.js が作る表の中の
   ラジオボタン「出願前/出願済み」「発表前/合格/不合格」「入金前/入金済み」) */
.progress-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
}

.progress-radio-label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
  cursor: pointer;
}

/* 進捗状況の画面の、自動保存の結果(保存中・保存しました・失敗)の表示 */
.progress-save-status {
  min-height: 1.4em;
  margin: 0 0 0.5rem 0;
  color: #666666;
  font-size: 0.85rem;
}

.progress-save-status.progress-save-error {
  color: #c0392b;
  font-weight: bold;
}

/* 進捗状況の画面で、対応が必要な時期の行(出願期間中、または合格して
   入金締切の前)を、行全体のオレンジで目立たせる(2026-09-26)。
   スマホ表示(カード形式)でも、カード全体がオレンジになる。 */
.data-editor-table tr.progress-row-highlight,
.data-editor-table tr.progress-row-highlight td {
  background-color: #ffd8a8;
}

.gantt-control-panel {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin: 0 0 8px 0;
  padding: 12px 16px;
  background: #f7f8fa;
  border: 1px solid #d7dce2;
  border-radius: 8px;
}

.gantt-control-title {
  min-width: 100px;
  padding-top: 4px;
  font-weight: bold;
}

.gantt-checkbox-container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  flex: 1;
}

.gantt-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 5px;
}

.gantt-checkbox-label:hover {
  background: #eaf0f8;
}

.gantt-button-container {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.gantt-status-message {
  min-height: 1.4em;
  margin: 2px 0 4px 4px;
  color: #666666;
  font-size: 0.85rem;
}

.gantt-operation-note {
  margin: 4px 0 8px 0;
  padding: 8px 12px;
  background: #f8fafc;
  border-left: 4px solid #4c78a8;
  color: #555555;
  font-size: 0.85rem;
  line-height: 1.6;
}

.gantt-plot {
  width: 100%;
}

.gantt-warning-list {
  margin: 0 0 1rem 1.2rem;
  color: #666666;
  font-size: 0.85rem;
}
