/* 画面全体を「ヘッダー + 本体 + フッター」の縦flexにする */
.settings-page {
  height: 100vh;

  display: flex;
  flex-direction: column;
}

h2 {
  margin-bottom: 8px;
}

.page-header {
  margin-bottom: 12px;
}

/* Mobile nav (left-pane alternative) */
.settings-mobile-nav {
  display: none;
  margin: 8px 14px 0;
}

.settings-mobile-nav select {
  width: 100%;
  max-width: 520px;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
}

.header-actions {
  margin-top: 8px;
  margin-left: 24px;
  /* ← ここが「良い感じの左マージン」 */
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.save-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.save-button {
  width: fit-content;
  padding: 6px 14px;
  font-size: 14px;
}

/* 変更内容は保存するまで反映されません */
.save-note {
  font-size: 12px;
  color: #666;
  margin: 8px 0 2px;
}

/*  設定を保存するにはログインが必要です。 */
.settings-warning {
  font-size: 12px;
  color: #b00020;
  margin-bottom: 2px;
}

/* ※ 未保存の変更があります */
.save-row {
  display: flex;
  align-items: center;
  gap: 20px;
  /* ← ボタンと状態表示の距離 */
}

.save-status {
  font-size: 16px;
  color: #666;
  margin-top: 6px;
}

.save-status.unsaved {
  color: #b00020;
  font-weight: 600;
}

.issue-list {
  list-style: none;
  padding: 0;
}


.bulk-actions {
  margin-bottom: 8px;
}

.firm-deposit-table tr.disabled {
  /* opacity: 0.4; */
  width: 100%;
  table-layout: fixed;
}

/* 念のため、th 側の中央寄せを無効化 */
.firm-deposit-table th {
  text-align: left;
}

/* チェックボックス自体を完全中央に */
.firm-deposit-table td:nth-child(1) input[type="checkbox"] {
  display: block;
  margin: 0 auto;
}

/* 表示列（1列目） */
.firm-deposit-table th:nth-child(1),
.firm-deposit-table td:nth-child(1) {
  width: 56px;
  /* 少しだけ余裕を持たせる */
  text-align: center;
  vertical-align: middle;
  padding-left: 0;
  padding-right: 0;
}

/* 2列目（証券会社名）を広げる */
.firm-deposit-table th:nth-child(2),
.firm-deposit-table td:nth-child(2) {
  width: 320px;
  /* ← 好みに応じて 280〜360px 程度で調整可 */
  padding-left: 14px;
  /* ← ここが効く */
  padding-right: 0px;
  text-align: left;
}

/* 3列目（入金額）も少し余裕を持たせる */
.firm-deposit-table th:nth-child(3),
.firm-deposit-table td:nth-child(3) {
  width: 160px;
}

.firm-deposit-table td:nth-child(3) input {
  margin-left: -2px;
  /* -1〜-4px で微調整 */
}

/* 入金額 input を広げる */
.firm-deposit-table input[type="number"],
.firm-deposit-table input[type="text"] {
  width: 140px;
  /* 既存より広め */
  box-sizing: border-box;
}

/* チェックボックス＋証券会社名を横並びで安定させる（念のため） */
.firm-deposit-table td:nth-child(2) label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* 入金額 input にフォーカスした行を強調表示 のため追記　
ここから*/
.firm-deposit-table tr.firm-row.is-focus {
  background: #eef6ff;
  /* table-row で border-left が効かない場合があるため inset shadow */
  box-shadow: inset 4px 0 0 #4a90e2;
}

.firm-deposit-table tr.firm-row.is-focus td:nth-child(2) {
  font-weight: 600;
}

/* ここまで */



.firm-list {
  list-style: none;
  padding: 0;
}

.firm-list li {
  padding: 4px;
}

.firm-list li.disabled {
  color: #999;
}

/* 本体（左右ペイン）は残り高さを全部使う */
.settings-split {
  display: flex;
  flex: 1;
  min-height: 0;
  /* ← これがないと子要素が縮められず崩れる */
  max-width: 1250px;
  /* ← 好きな幅に */
  margin: 0 auto;
  /* ← これが中央寄せ */
}

/* 左右ペインは中だけスクロール */
.left-pane,
.right-pane {
  min-height: 0;
  /* ← flexの子でスクロールさせるとき必須 */
  overflow-y: auto;
  /* ← はみ出しをクリップしてフッターに被さらない */
}

.left-pane {
  width: 280px;
  border-right: 1px solid #ccc;
  padding: 8px;
  overflow-y: auto;
}

.right-pane {
  flex: 1;
  max-width: 600px;
  padding: 16px;
  overflow-y: auto;

}

@media (mix-width: 1025px) {
  .right-pane {
    flex: 0 0 520px; /* ← 固定幅 */
    width: 520px; /* 念のため */
  }
}

.side-stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
  font-size: 16px;
}

.settings-help {
  font-size: 13px;
  line-height: 1.6;
}

.settings-help details {
  margin-top: 8px;
}

.settings-help summary {
  cursor: pointer;
  font-weight: 600;
}

.settings-help h3 {
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #ccc;
}

/* 広告枠 非表示 */
.detail-side {
  display: flex;
  border-left: 1px solid #ddd;
  padding-left: 20px;
  font-size: 14px;
  min-height: 0;
  /* ← flexの子でスクロールさせるとき必須 */
  overflow-y: auto;
  /* ← はみ出しをクリップしてフッターに被さらない */

  flex: 0 0 320px;
  /* ← 固定幅 */
  width: 320px;
  /* 念のため */

}

.ad-stack {
  display: none;
}



.policy-link {
  margin-left: 6px;
  font-size: 12px;
  text-decoration: none;
}

.policy-link:hover {
  text-decoration: underline;
}

/* =========================
   Mobile layout (Plan ①: top selector)
   - left-pane hidden
   - detail-side hidden
   - selector shown
   ========================= */
@media (max-width: 1024px) {

  /* max-widthの値はjs側もそろえること */
  .settings-split {
    flex-direction: column;
    flex: none;
    margin: 16px;
  }

  .settings-mobile-nav {
    display: block;
  }

  .left-pane {
    display: none;
  }

  .detail-side {
    display: block;
    border-left: none;
    /* PC用の境界線を解除 */
    border-top: 1px solid #ddd;
    padding-top: 16px;
    margin-top: 16px;

  }

  .right-pane {
    max-width: none;
    padding: 12px 14px;
  }

  /* table: prevent horizontal overflow as much as possible */
  .firm-deposit-table {
    width: 100%;
  }

  .firm-deposit-table th:nth-child(2),
  .firm-deposit-table td:nth-child(2) {
    width: auto;
  }

  .settings-page {
    height: auto;
    /* ← これが本命 */
    min-height: 100vh;
  }

  #firm-deposit-table {
    border-collapse: collapse;
  }

  #firm-deposit-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
  }


}




.right-panel {
  display: none;
}

.right-panel.active {
  display: block;
}

.left-section h3 {
  margin-top: 16px;
  font-size: 13px;
}

.menu-item,
.issue-item {
  padding: 4px 6px;
  cursor: pointer;
}

.menu-item.active,
.issue-item.active {
  background: #eef;
}

/* offering list */
.offering-firm-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.offering-firm-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid #eee;
}

.offering-firm-list li label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.offering-firm-list li .override-status {
  font-size: 12px;
  white-space: nowrap;
}

.offering-firm-list li .inherit-btn {
  white-space: nowrap;
}

.settings-footer {
  position: static !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  z-index: auto !important;

  margin-top: 16px;
  padding-top: 8px;
  border-top: 1px solid #ddd;
}

.settings-footer {
  display: inline-block;
}

/* ===== 広告スタック ===== */
.ad-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 300x250 枠 */
.ad-300x250 {
  /* margin-top: 32px; */
  width: 300px;
  height: 250px;
  background: #f5f5f5;
  border: 1px dashed #ccc;
  border-radius: 8px;
}


/* 中央寄せ（右ペイン内） */
.detail-side .ad-stack {
  align-items: center;
}

.detail-side {
  margin-left: 12px;
  /* 中央コンテンツとの間 */
  margin-right: 12px;
  /* 画面右端との間 */
}


/* 画面が狭い場合（モバイル）は上の Plan ① でまとめて制御 */