/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* ── ローディングオーバーレイ ───────────────────────────────── */
#loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  align-items: center;
  justify-content: center;
}
#loading-overlay.is-active {
  display: flex;
}

/* Spinkit Cube Grid */
.sk-cube-grid {
  width: 40px;
  height: 40px;
  margin: 100px auto;
}

.sk-cube-grid .sk-cube {
  width: 33%;
  height: 33%;
  background-color: currentColor;
  float: left;
  -webkit-animation: sk-cubeGridScaleDelay 1.3s infinite ease-in-out;
          animation: sk-cubeGridScaleDelay 1.3s infinite ease-in-out; 
}
.sk-cube-grid .sk-cube1 {
  -webkit-animation-delay: 0.2s;
          animation-delay: 0.2s; }
.sk-cube-grid .sk-cube2 {
  -webkit-animation-delay: 0.3s;
          animation-delay: 0.3s; }
.sk-cube-grid .sk-cube3 {
  -webkit-animation-delay: 0.4s;
          animation-delay: 0.4s; }
.sk-cube-grid .sk-cube4 {
  -webkit-animation-delay: 0.1s;
          animation-delay: 0.1s; }
.sk-cube-grid .sk-cube5 {
  -webkit-animation-delay: 0.2s;
          animation-delay: 0.2s; }
.sk-cube-grid .sk-cube6 {
  -webkit-animation-delay: 0.3s;
          animation-delay: 0.3s; }
.sk-cube-grid .sk-cube7 {
  -webkit-animation-delay: 0s;
          animation-delay: 0s; }
.sk-cube-grid .sk-cube8 {
  -webkit-animation-delay: 0.1s;
          animation-delay: 0.1s; }
.sk-cube-grid .sk-cube9 {
  -webkit-animation-delay: 0.2s;
          animation-delay: 0.2s; }

@-webkit-keyframes sk-cubeGridScaleDelay {
  0%, 70%, 100% {
    -webkit-transform: scale3D(1, 1, 1);
            transform: scale3D(1, 1, 1);
  } 35% {
    -webkit-transform: scale3D(0, 0, 1);
            transform: scale3D(0, 0, 1); 
  }
}

@keyframes sk-cubeGridScaleDelay {
  0%, 70%, 100% {
    -webkit-transform: scale3D(1, 1, 1);
            transform: scale3D(1, 1, 1);
  } 35% {
    -webkit-transform: scale3D(0, 0, 1);
            transform: scale3D(0, 0, 1);
  } 
}

/* =====================================================
   基本フォント: Noto Sans JP（レイアウトで Google Fonts から読込）
   Bootstrap 既定の system-ui は Windows で游ゴシック UI になり 400 が極端に細く見えるため、
   OS を問わず同じ太さで見える Noto Sans JP を最優先にする。
   ※ PDF（layouts/pdf・pdf.css）は GenMincho をローカルで読む別系統なので影響しない
===================================================== */
:root {
  --bs-font-sans-serif: "Noto Sans JP", system-ui, -apple-system, "Segoe UI", Roboto, "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --bs-body-font-family: var(--bs-font-sans-serif);
}
body {
  font-family: var(--bs-body-font-family);
  -webkit-font-smoothing: antialiased;
}
/* 数字は等幅で桁を揃える（金額・件数の列がそろう） */
.table td, .table th { font-variant-numeric: tabular-nums; }

/* =====================================================
   カラーテーマ: Excel グリーン系（既定）
   Primary  : #1e7145  (Excel ダークグリーン)
   Secondary: #2e9e6d  (ミディアムグリーン・ホバー用)
   Light bg : #f0f7f3  (極薄グリーン・ページ背景)
   Table hd : #d6ead9  (薄緑・テーブルヘッダー)

   画面ごとに色を変えられるよう、テーブルヘッダー・ボタン・タブ等の
   テーマ色は下の CSS 変数を参照する。画面単位で色を変えたいときは、
   その画面の一番外側の要素に .theme-xxx を付ける（例: .theme-aqua）。
   CSS 変数は子孫に継承されるので、その配下だけ色が差し替わる。
===================================================== */
:root {
  --theme-primary:            #1e7145;  /* 主要色（ボタン・リンク・見出し） */
  --theme-primary-deep:       #155233;  /* ホバー時の濃い色 */
  --theme-primary-mid:        #2e9e6d;  /* フォーカス枠など中間色 */
  --theme-primary-border:     #1a6140;  /* 塗りボタンの枠線 */
  --theme-primary-deep-border:#124629;  /* 塗りボタン（ホバー）の枠線 */
  --theme-head:               #d6ead9;  /* テーブルヘッダー背景 */
  --theme-head-ink:           #1a3d26;  /* テーブルヘッダー文字 */
  --theme-soft:               #e8f5ea;  /* 淡い背景（アイコンチップ・行ホバー） */
  --theme-accent:             #8dc21f;  /* 見出し左のバーのグラデーション先（ロゴの黄緑） */
  --theme-rgb:                30, 113, 69;    /* 影・フォーカスリング用 */
  --theme-rgb-mid:            46, 158, 109;
}

/* 水色系テーマ（共同事業申込一覧） */
.theme-aqua {
  --theme-primary:            #0c6ea2;
  --theme-primary-deep:       #08517a;
  --theme-primary-mid:        #2196c9;
  --theme-primary-border:     #0a5f8c;
  --theme-primary-deep-border:#06456a;
  --theme-head:               #d3e9f7;
  --theme-head-ink:           #0d3f5c;
  --theme-soft:               #e6f3fb;
  --theme-accent:             #5ec8ea;
  --theme-rgb:                12, 110, 162;
  --theme-rgb-mid:            33, 150, 201;
}
/* テーマ画面内では Bootstrap の success 系ボタン（CSV出力・月タブの選択月）もテーマ色に合わせる */
.theme-aqua .btn-success {
  --bs-btn-bg:                  var(--theme-primary);
  --bs-btn-border-color:        var(--theme-primary-border);
  --bs-btn-hover-bg:            var(--theme-primary-deep);
  --bs-btn-hover-border-color:  var(--theme-primary-deep-border);
  --bs-btn-active-bg:           var(--theme-primary-deep);
  --bs-btn-active-border-color: var(--theme-primary-deep-border);
}
.theme-aqua .btn-outline-success {
  --bs-btn-color:               var(--theme-primary);
  --bs-btn-border-color:        var(--theme-primary);
  --bs-btn-hover-bg:            var(--theme-primary);
  --bs-btn-hover-border-color:  var(--theme-primary);
  --bs-btn-active-bg:           var(--theme-primary-deep);
  --bs-btn-active-border-color: var(--theme-primary-deep);
}

/* =====================================================
   モダンナビゲーション（shared/_navigation.html.erb）
   ・白基調のガラス調（半透明＋backdrop-filter）
   ・上端にロゴカラー（緑→黄緑→黄）のグラデーションライン（静止）
   ・スティッキー。スクロールで縮小＆影（.is-scrolled は navbar_controller.js）
   ・リンクは下線がスライドイン、ドロップダウンはフェード＋スライドで出現
===================================================== */
:root {
  --nav-green:      #1e7145;
  --nav-green-deep: #155233;
  --nav-lime:       #8dc21f;   /* ロゴの黄緑 */
  --nav-yellow:     #d4dd26;   /* ロゴの黄 */
  --nav-ink:        #1f2a24;   /* 文字色 */
  --nav-muted:      #6a7a71;
  --nav-tint:       #eef7f1;   /* ホバー背景 */
  --nav-ease:       cubic-bezier(.22, 1, .36, 1);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: rgba(255, 255, 255, .86);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
          backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid rgba(30, 113, 69, .08);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset;
  transition: box-shadow .35s var(--nav-ease), background-color .35s var(--nav-ease);
}
.site-header.is-scrolled {
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 .5rem 1.5rem -.75rem rgba(16, 40, 28, .22), 0 1px 0 rgba(30, 113, 69, .06);
}

/* 上端のアクセントライン（静止。動かすとブラウザの読み込みバーと紛らわしいため） */
.site-header__accent {
  height: 4px;
  background: linear-gradient(90deg, var(--nav-green) 0%, var(--nav-lime) 55%, var(--nav-yellow) 100%);
}

.site-nav {
  padding-top: .8rem;
  padding-bottom: .8rem;
  transition: padding .3s var(--nav-ease);
}
.site-header.is-scrolled .site-nav {
  padding-top: .4rem;
  padding-bottom: .4rem;
}

/* ロゴ */
.site-nav__brand {
  display: inline-flex;
  align-items: center;
  padding: 0;
  margin-right: 1.5rem;
}
.site-nav__logo {
  height: 30px;
  width: auto;
  transition: transform .3s var(--nav-ease), height .3s var(--nav-ease);
}
.site-header.is-scrolled .site-nav__logo { height: 26px; }
.site-nav__brand:hover .site-nav__logo { transform: translateY(-1px) scale(1.03); }

/* メニューリンク */
.site-nav__menu { gap: .15rem; }
.site-nav__link.nav-link {
  position: relative;
  color: var(--nav-ink);
  font-weight: 600;
  font-size: .93rem;
  letter-spacing: .01em;
  padding: .55rem .9rem;
  border-radius: .6rem;
  transition: color .2s var(--nav-ease), background-color .2s var(--nav-ease), transform .2s var(--nav-ease);
}
.site-nav__link.nav-link::before {
  content: "";
  position: absolute;
  left: .9rem;
  right: .9rem;
  bottom: .3rem;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--nav-green), var(--nav-lime));
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .28s var(--nav-ease);
}
.site-nav__link.nav-link:hover,
.site-nav__link.nav-link:focus-visible,
.site-nav__link.nav-link.dropdown-toggle.show {
  color: var(--nav-green-deep);
  background-color: var(--nav-tint);
}
.site-nav__link.nav-link:hover::before,
.site-nav__link.nav-link:focus-visible::before,
.site-nav__link.nav-link.dropdown-toggle.show::before {
  transform: scaleX(1);
}
.site-nav__link.nav-link:focus-visible {
  outline: 3px solid rgba(46, 158, 109, .35);
  outline-offset: 2px;
}
/* 現在ページ */
.site-nav__link.nav-link.is-active {
  color: var(--nav-green-deep);
}
.site-nav__link.nav-link.is-active::before {
  transform: scaleX(1);
  transform-origin: center;
}
/* Bootstrap 標準の三角キャレットは消し、細いシェブロン（span）に置き換える。開いたら回転 */
.site-nav__link.dropdown-toggle::after { content: none; }
.site-nav__link.dropdown-toggle {
  display: flex;
  align-items: center;
  gap: .4em;
}
.site-nav__chevron {
  display: inline-block;
  width: .42em;
  height: .42em;
  margin-top: -.15em;
  border: solid currentColor;
  border-width: 0 1.6px 1.6px 0;
  transform: rotate(45deg);
  transition: transform .25s var(--nav-ease);
}
.site-nav__link.dropdown-toggle.show .site-nav__chevron {
  transform: rotate(-135deg) translateY(-.1em);
}

/* ドロップダウンメニュー */
.site-nav__dropdown-menu.dropdown-menu {
  margin-top: .55rem;
  min-width: 15.5rem;
  padding: .5rem;
  border: 1px solid rgba(30, 113, 69, .08);
  border-radius: .9rem;
  background: rgba(255, 255, 255, .96);
  -webkit-backdrop-filter: blur(16px);
          backdrop-filter: blur(16px);
  box-shadow: 0 1.25rem 2.5rem -1rem rgba(16, 40, 28, .28), 0 .25rem .75rem rgba(16, 40, 28, .06);
}
.site-nav__dropdown-menu.dropdown-menu.show {
  animation: nav-drop-in .26s var(--nav-ease) both;
}
@keyframes nav-drop-in {
  from { opacity: 0; transform: translateY(-10px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
/* メニューの吹き出し三角 */
.site-nav__dropdown-menu.dropdown-menu::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 1.4rem;
  width: 12px;
  height: 12px;
  background: #fff;
  border-left: 1px solid rgba(30, 113, 69, .08);
  border-top: 1px solid rgba(30, 113, 69, .08);
  transform: rotate(45deg);
}
.site-nav__dropdown-menu .dropdown-divider {
  margin: .4rem .5rem;
  border-color: rgba(30, 113, 69, .12);
}
.site-nav__item.dropdown-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .55rem .7rem;
  border-radius: .6rem;
  color: var(--nav-ink);
  font-size: .9rem;
  font-weight: 500;
  transition: background-color .18s var(--nav-ease), color .18s var(--nav-ease), transform .18s var(--nav-ease);
}
.site-nav__item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  flex: none;
  border-radius: .5rem;
  background: var(--nav-tint);
  color: var(--nav-green);
  font-size: .95rem;
  transition: background-color .18s var(--nav-ease), color .18s var(--nav-ease), transform .18s var(--nav-ease);
}
.site-nav__item.dropdown-item:hover,
.site-nav__item.dropdown-item:focus {
  background-color: var(--nav-tint);
  color: var(--nav-green-deep);
  transform: translateX(3px);
}
.site-nav__item.dropdown-item:hover .site-nav__item-icon,
.site-nav__item.dropdown-item:focus .site-nav__item-icon {
  background: var(--nav-green);
  color: #fff;
  transform: scale(1.06);
}
.site-nav__item.dropdown-item.is-active {
  color: var(--nav-green-deep);
  font-weight: 700;
}
.site-nav__item.dropdown-item.is-active .site-nav__item-icon {
  background: var(--nav-green);
  color: #fff;
}
/* 開いたときに項目が順番にふわっと出る */
.site-nav__dropdown-menu.show > li {
  animation: nav-item-in .32s var(--nav-ease) both;
}
.site-nav__dropdown-menu.show > li:nth-child(1) { animation-delay: .02s; }
.site-nav__dropdown-menu.show > li:nth-child(2) { animation-delay: .05s; }
.site-nav__dropdown-menu.show > li:nth-child(3) { animation-delay: .08s; }
.site-nav__dropdown-menu.show > li:nth-child(4) { animation-delay: .11s; }
.site-nav__dropdown-menu.show > li:nth-child(5) { animation-delay: .14s; }
.site-nav__dropdown-menu.show > li:nth-child(6) { animation-delay: .17s; }
.site-nav__dropdown-menu.show > li:nth-child(7) { animation-delay: .20s; }
.site-nav__dropdown-menu.show > li:nth-child(n+8) { animation-delay: .23s; }
@keyframes nav-item-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 右側: ユーザー情報＋ログアウト */
.site-nav__user {
  display: flex;
  align-items: center;
  gap: .75rem;
}
/* ログイン中の表示はユーザー設定へのリンク（ナビが詰まるので独立項目にはしない） */
.site-nav__account {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .3rem .8rem .3rem .3rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(30, 113, 69, .12);
  box-shadow: 0 .15rem .5rem rgba(16, 40, 28, .06);
  text-decoration: none;
  cursor: pointer;
  transition: border-color .2s var(--nav-ease), box-shadow .2s var(--nav-ease), transform .2s var(--nav-ease);
}
.site-nav__account:hover,
.site-nav__account:focus-visible {
  border-color: rgba(30, 113, 69, .45);
  box-shadow: 0 .4rem .9rem -.3rem rgba(30, 113, 69, .35);
  transform: translateY(-1px);
}
.site-nav__account:focus-visible { outline: 3px solid rgba(46, 158, 109, .35); outline-offset: 2px; }
.site-nav__account-gear {
  font-size: .9rem;
  color: var(--nav-muted);
  transition: color .2s var(--nav-ease), transform .2s var(--nav-ease);
}
.site-nav__account:hover .site-nav__account-gear,
.site-nav__account:focus-visible .site-nav__account-gear {
  color: var(--nav-green);
  transform: rotate(45deg);
}
.site-nav__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--nav-green), var(--nav-lime));
  color: #fff;
  font-weight: 700;
  font-size: .85rem;
  flex: none;
}
.site-nav__account-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.site-nav__account-label {
  font-size: .62rem;
  color: var(--nav-muted);
  letter-spacing: .04em;
}
.site-nav__account-name {
  font-size: .85rem;
  color: var(--nav-ink);
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.site-nav__logout,
.site-nav__login {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s var(--nav-ease), color .2s var(--nav-ease), transform .2s var(--nav-ease), box-shadow .2s var(--nav-ease);
}
.site-nav__logout {
  background: transparent;
  color: var(--nav-green);
  border: 1.5px solid rgba(30, 113, 69, .35);
}
.site-nav__logout:hover,
.site-nav__logout:focus-visible {
  background: var(--nav-green);
  border-color: var(--nav-green);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 .4rem .9rem -.3rem rgba(30, 113, 69, .55);
}
.site-nav__login {
  background: linear-gradient(135deg, var(--nav-green), #2e9e6d);
  color: #fff;
  border: 0;
  box-shadow: 0 .35rem .9rem -.35rem rgba(30, 113, 69, .6);
}
.site-nav__login:hover,
.site-nav__login:focus-visible {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 .6rem 1.1rem -.35rem rgba(30, 113, 69, .65);
}
.site-nav__logout i,
.site-nav__login i { font-size: 1rem; }

/* ハンバーガー（3本線 → ×）。aria-expanded は Bootstrap collapse が切り替える */
.site-nav__toggler {
  position: relative;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid rgba(30, 113, 69, .15);
  border-radius: .7rem;
  background: #fff;
  padding: 0;
  cursor: pointer;
  transition: background-color .2s var(--nav-ease), border-color .2s var(--nav-ease);
}
.site-nav__toggler:hover { background: var(--nav-tint); }
.site-nav__toggler:focus-visible { outline: 3px solid rgba(46, 158, 109, .35); outline-offset: 2px; }
.site-nav__toggler span {
  position: absolute;
  left: .7rem;
  right: .7rem;
  height: 2px;
  border-radius: 2px;
  background: var(--nav-green);
  transition: transform .3s var(--nav-ease), opacity .2s var(--nav-ease), top .3s var(--nav-ease);
}
.site-nav__toggler span:nth-child(1) { top: .8rem; }
.site-nav__toggler span:nth-child(2) { top: calc(50% - 1px); }
.site-nav__toggler span:nth-child(3) { top: calc(100% - .8rem - 2px); }
.site-nav__toggler[aria-expanded="true"] span:nth-child(1) { top: calc(50% - 1px); transform: rotate(45deg); }
.site-nav__toggler[aria-expanded="true"] span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.site-nav__toggler[aria-expanded="true"] span:nth-child(3) { top: calc(50% - 1px); transform: rotate(-45deg); }

/* PC 幅（lg 以上）ではハンバーガーを出さない（Bootstrap の .navbar-toggler を使っていないため自前で制御） */
@media (min-width: 992px) {
  .site-nav__toggler { display: none; }
}

/* ── モバイル（lg 未満）: 折りたたみ時のレイアウト ── */
@media (max-width: 991.98px) {
  .site-nav__collapse {
    margin-top: .75rem;
    padding: .5rem 0 .75rem;
    border-top: 1px solid rgba(30, 113, 69, .1);
  }
  .site-nav__menu { gap: .1rem; }
  .site-nav__link.nav-link { padding: .7rem .9rem; }
  .site-nav__link.nav-link::before { display: none; }
  .site-nav__link.nav-link.is-active { background-color: var(--nav-tint); }
  /* モバイルはインライン展開（影・三角なし） */
  .site-nav__dropdown-menu.dropdown-menu {
    margin: .25rem 0 .5rem .75rem;
    min-width: 0;
    padding: .25rem 0 .25rem .5rem;
    border: 0;
    border-left: 2px solid rgba(30, 113, 69, .18);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    -webkit-backdrop-filter: none;
            backdrop-filter: none;
  }
  .site-nav__dropdown-menu.dropdown-menu::before { display: none; }
  .site-nav__dropdown-menu.dropdown-menu.show { animation: nav-drop-in .22s var(--nav-ease) both; }
  .site-nav__user {
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid rgba(30, 113, 69, .1);
    justify-content: space-between;
  }
  .site-nav__account-name { max-width: 14rem; }
}
/* 中間幅（lg〜xl）はメニューが多いので詰める */
@media (min-width: 992px) and (max-width: 1399.98px) {
  .site-nav__link.nav-link { padding: .5rem .65rem; font-size: .88rem; }
  .site-nav__link.nav-link::before { left: .65rem; right: .65rem; }
  .site-nav__brand { margin-right: 1rem; }
  .site-nav__account-text { display: none; }
  .site-nav__account-gear { display: none; }
  .site-nav__account { padding: .25rem; }
  .site-nav__logout span { display: none; }
  .site-nav__logout { padding: .5rem .7rem; }
}

/* ── アニメーション抑制設定を尊重 ── */
@media (prefers-reduced-motion: reduce) {
  .site-header, .site-nav, .site-nav__logo, .site-nav__link.nav-link, .site-nav__link.nav-link::before,
  .site-nav__item.dropdown-item, .site-nav__item-icon, .site-nav__logout, .site-nav__login,
  .site-nav__account, .site-nav__account-gear,
  .site-nav__toggler span, .site-nav__link.dropdown-toggle::after {
    transition: none !important;
  }
  .site-nav__dropdown-menu.dropdown-menu.show,
  .site-nav__dropdown-menu.show > li {
    animation: none !important;
  }
}

/* ── プライマリボタン ── */
.btn-primary {
  background-color: var(--theme-primary);
  border-color:     var(--theme-primary-border);
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  background-color: var(--theme-primary-deep);
  border-color:     var(--theme-primary-deep-border);
}

/* ── アウトラインボタン（ナビ右のログアウト等） ── */
.btn-outline-primary {
  color:        var(--theme-primary);
  border-color: var(--theme-primary);
}
.btn-outline-primary:hover {
  background-color: var(--theme-primary);
  border-color:     var(--theme-primary);
}

/* =====================================================
   モダンボタン（全画面共通）
   各バリアントの色（btn-primary=緑 / btn-warning=黄 / outline 系）はそのまま引き継ぎ、
   角丸・太字・ホバーで浮き上がり・押下で沈み込み・ボタン色の影で統一感を出す。
   input-group / btn-group 内は結合部の角丸を Bootstrap が制御するため浮き上がりのみ無効化。
===================================================== */
.btn {
  --bs-btn-border-radius: .6rem;
  --bs-btn-font-weight: 600;
  --bs-btn-padding-x: 1.1rem;
  --bs-btn-padding-y: .5rem;
  letter-spacing: .01em;
  transition: background-color .2s var(--nav-ease), border-color .2s var(--nav-ease), color .2s var(--nav-ease),
              transform .2s var(--nav-ease), box-shadow .2s var(--nav-ease);
}
.btn-sm {
  --bs-btn-border-radius: .5rem;
  --bs-btn-padding-x: .75rem;
  --bs-btn-padding-y: .32rem;
}
.btn-lg {
  --bs-btn-border-radius: .8rem;
  --bs-btn-padding-x: 1.4rem;
  --bs-btn-padding-y: .65rem;
}

/* 塗りボタン: 上部にわずかなハイライト＋ボタン色の影 */
.btn-primary, .btn-secondary, .btn-success, .btn-danger, .btn-warning, .btn-info, .btn-dark {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, 0) 60%);
  box-shadow: 0 .25rem .6rem -.3rem rgba(16, 40, 28, .35);
  box-shadow: 0 .3rem .7rem -.3rem color-mix(in srgb, var(--bs-btn-bg) 60%, transparent);
}
.btn-primary:hover, .btn-secondary:hover, .btn-success:hover, .btn-danger:hover, .btn-warning:hover, .btn-info:hover, .btn-dark:hover {
  box-shadow: 0 .5rem 1rem -.35rem rgba(16, 40, 28, .45);
  box-shadow: 0 .55rem 1.1rem -.35rem color-mix(in srgb, var(--bs-btn-bg) 70%, transparent);
}
.btn-warning { --bs-btn-bg: #ffc107; --bs-btn-border-color: #f0b400; --bs-btn-hover-bg: #f5b800; --bs-btn-hover-border-color: #e2a800; }
.btn-primary { --bs-btn-bg: var(--theme-primary); } /* 影の色計算用（実際の背景は上の .btn-primary 指定） */

/* アウトラインボタン: 白地・細めの枠。ホバーで塗り（Bootstrap 既定）＋浮き上がり */
[class*="btn-outline-"] {
  background-color: #fff;
  border-width: 1.5px;
}
.btn-outline-secondary { --bs-btn-color: #55606a; --bs-btn-border-color: #c9d2cd; --bs-btn-hover-bg: #55606a; --bs-btn-hover-border-color: #55606a; }
.btn-outline-light { background-color: transparent; }

/* ホバーで浮く／押すと沈む */
.btn:hover { transform: translateY(-1px); }
.btn:active, .btn.active { transform: translateY(0) scale(.98); }
.btn:disabled, .btn.disabled { transform: none; box-shadow: none; }
.btn:focus-visible { box-shadow: 0 0 0 .2rem rgba(var(--theme-rgb-mid), .3); }

/* 結合ボタン・閉じる・リンク風は浮かせない */
.input-group .btn, .btn-group .btn, .btn-close, .btn-link, .page-link {
  transform: none !important;
}
.input-group .btn, .btn-group .btn { box-shadow: none; }
.btn-link { --bs-btn-font-weight: 500; }

/* アイコン付きボタン: アイコンと文字の間隔 */
.btn > .bi + * , .btn > .bi { vertical-align: -.05em; }
.btn > .bi:not(:only-child) { margin-right: .35rem; }

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .btn:hover, .btn:active { transform: none; }
}

/* =====================================================
   ページ見出し（一覧画面の <h1 class="display-6">）
   Bootstrap の display-6 は細字300＋下マージン .5rem のため、検索条件の見出し
   （.form-section-title: 太字700・var(--theme-head-ink)）と別フォントのように見え、
   横のボタンと縦位置もズレていた。同じトーンに揃え、左に緑のアクセントバーを付ける。
   ホーム画面のウェルカム（.card-title）は対象外。
===================================================== */
h1.display-6:not(.card-title) {
  position: relative;
  font-size: clamp(1.35rem, 1.1rem + .8vw, 1.65rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: .01em;
  color: var(--theme-head-ink);
  margin-bottom: 0;
  padding-left: .9rem;
}
h1.display-6:not(.card-title)::before {
  content: "";
  position: absolute;
  left: 0;
  top: .12em;
  bottom: .12em;
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--theme-primary), var(--theme-accent));
}
/* ── テーブルヘッダー ── */
.table-light thead,
thead.table-light {
  background-color: var(--theme-head) !important;
}
.table thead th {
  background-color: var(--theme-head);
  color:            var(--theme-head-ink);
}
.table th, .table td {
  white-space: nowrap;
}

/* ── カードのシャドウ色を緑系に ── */
.card.shadow,
.card.shadow-sm {
  box-shadow: 0 .125rem .5rem rgba(var(--theme-rgb), .12) !important;
}

/* ── ダッシュボードの機能カード（カード全体がリンク。ホバーで浮き上がる） ── */
a .feature-card {
  transition: box-shadow .15s ease, transform .15s ease;
}
a .feature-card:hover {
  box-shadow: 0 .4rem 1rem rgba(var(--theme-rgb), .18) !important;
  transform: translateY(-2px);
}

/* ── ダッシュボードの機能アイコン（Bootstrap Icons・テーマ緑） ── */
.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: .5rem;
  background-color: var(--theme-soft);
  color: var(--theme-primary);
  font-size: 1.15rem;
  flex-shrink: 0;
}

/* ── バッジ（bg-success はそのまま流用） ── */

/* 売契締結先（契約先）チップ: アドインテ=黄緑 / DC7=水色 */
.badge-doc-adinte { background-color: #c5e1a5; color: #33691e; }
.badge-doc-dc7    { background-color: #b3e5fc; color: #01579b; }

/* 目標・月指定・連携チップ:
   Bootstrap標準の bg-info text-dark（鮮やかな水色＋黒）はコントラストが悪く浮くため、
   他のチップと同じ「淡い背景＋濃い同系色の文字」に統一する */
.badge-target    { background-color: #dbe4fb; color: #2c4a9e; }  /* 目標・月指定の期間 */
.badge-link-bill { background-color: #b3e5fc; color: #01579b; }  /* 連携している契約管理No */
.badge-upcoming  { background-color: #dbe4fb; color: #2c4a9e; }  /* お知らせ: 公開予定 */

/* 代理店手数料管理表（刀用・アドインテ様用）: 縦罫線 */
.fee-table th, .fee-table td {
  border-right: 1px solid #dee2e6;
}
.fee-table th:last-child, .fee-table td:last-child {
  border-right: none;
}

/* 刀管理表: 受注確度バッジ（指定デザイン: A=紫 B=橙 C=黄 アタック=水色 受注=濃赤 失注=黒） */
.badge-prob-a      { background-color: #dcc9f2; color: #5b2d90; }
.badge-prob-b      { background-color: #f9b489; color: #a63e00; }
.badge-prob-c      { background-color: #fbe38e; color: #8a6a00; }
.badge-prob-attack { background-color: #cce4fb; color: #1667c9; }
.badge-prob-won    { background-color: #9e0f0f; color: #fff; }
.badge-prob-lost   { background-color: #3b3b3b; color: #fff; }

/* ── フォーカスリング ── */
.form-control:focus,
.form-select:focus {
  border-color: var(--theme-primary-mid);
  box-shadow:   0 0 0 .2rem rgba(var(--theme-rgb), .25);
}

/* ── アクティブ・選択状態リンク ── */
a {
  color: var(--theme-primary);
}
a:hover {
  color: var(--theme-primary-deep);
}

/* ── ドロップダウン選択時ハイライト ── */
.dropdown-item:hover,
.dropdown-item:focus {
  background-color: var(--theme-soft);
  color:            var(--theme-primary-deep);
}

/* ── ページネーション ── */
.page-link {
  color: var(--theme-primary);
}
.page-item.active .page-link {
  background-color: var(--theme-primary);
  border-color:     var(--theme-primary);
}

/* ── 一覧テーブル: 操作列を右端固定 ── */
.table-sticky-actions {
  --sticky-actions-bg: #fff;
}

.table-sticky-actions thead th:last-child,
.table-sticky-actions tbody td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  background-color: var(--sticky-actions-bg);
}

.table-sticky-actions thead th:last-child {
  z-index: 3;
  box-shadow: -8px 0 8px -8px rgba(0, 0, 0, 0.18);
}

.table-sticky-actions tbody td:last-child {
  box-shadow: -8px 0 8px -8px rgba(0, 0, 0, 0.12);
}

.table-sticky-actions .table-light th:last-child,
.table-sticky-actions thead.table-light th:last-child,
.table-sticky-actions thead th:last-child {
  --sticky-actions-bg: var(--theme-head);
}

/* 複数の操作列を右固定したい一覧向け（例: 編集 + 詳細） */
.table-sticky-actions.table-sticky-actions-double {
  --sticky-actions-col-width: 80px;
}

.table-sticky-actions.table-sticky-actions-double thead th:last-child,
.table-sticky-actions.table-sticky-actions-double tbody td:last-child,
.table-sticky-actions.table-sticky-actions-double thead th:nth-last-child(2),
.table-sticky-actions.table-sticky-actions-double tbody td:nth-last-child(2) {
  width: var(--sticky-actions-col-width);
  min-width: var(--sticky-actions-col-width);
  max-width: var(--sticky-actions-col-width);
}

.table-sticky-actions.table-sticky-actions-double thead th:last-child,
.table-sticky-actions.table-sticky-actions-double thead th:nth-last-child(2) {
  background-color: var(--theme-head);
}

.table-sticky-actions.table-sticky-actions-double thead th:nth-last-child(2),
.table-sticky-actions.table-sticky-actions-double tbody td:nth-last-child(2) {
  position: sticky;
  right: var(--sticky-actions-col-width);
  z-index: 2;
  background-color: var(--sticky-actions-bg);
}

.table-sticky-actions.table-sticky-actions-double thead th:nth-last-child(2) {
  z-index: 3;
  box-shadow: -8px 0 8px -8px rgba(0, 0, 0, 0.18);
}



/* =====================================================
   モダンフォーム（.form-modern）
   セクション見出しにアイコンバッジ、入力欄を角丸＋アイコン付きにする。
   色はシステムのテーマ（Excelグリーン）に合わせる。
   使い方: フォームのラッパーに form-modern、見出しに
   <h5 class="form-section-title" data-icon="&#xF1D8;">…</h5>（Bootstrap Icons のグリフ）
===================================================== */
.form-modern .form-section-title,
.search-modern .form-section-title {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--theme-head-ink);
  padding-bottom: .75rem;
  border-bottom: 1px solid #e3ebe6;
  margin-bottom: 1.25rem;
}
.form-modern .form-section-title::before,
.search-modern .form-section-title::before {
  content: attr(data-icon);
  font-family: "bootstrap-icons";
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: .5rem;
  background-color: var(--theme-soft);
  color: var(--theme-primary);
  font-size: 1rem;
  flex-shrink: 0;
}

/* ラベル: 少し小さめの太字グレー */
.form-modern .form-label {
  font-size: .82rem;
  font-weight: 600;
  color: #55606a;
  margin-bottom: .35rem;
}

/* 入力欄: 角丸・ゆったり・落ち着いた枠線 */
.form-modern .form-control,
.form-modern .form-select {
  border-radius: .5rem;
  border-color: #dfe5e2;
  padding: .5rem .75rem;
  background-color: #fff;
}
.form-modern .form-control:hover,
.form-modern .form-select:hover {
  border-color: #c3d3c9;
}
.form-modern .form-control:focus,
.form-modern .form-select:focus {
  border-color: var(--theme-primary-mid);
  box-shadow: 0 0 0 .18rem rgba(var(--theme-rgb-mid), .18);
}
.form-modern .form-control::placeholder { color: #b6bfc6; }
.form-modern .form-text { font-size: .75rem; color: #8a949c; }

/* 日付・月の入力にカレンダーアイコンを表示（ネイティブのピッカーは残す） */
.form-modern input[type="date"],
.form-modern input[type="month"] {
  padding-left: 2.1rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%236c7b73'%3E%3Cpath d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: .7rem center;
  background-size: 1rem 1rem;
}
/* セレクトは右の矢印を残しつつ左にリストアイコン */
.form-modern select.form-select {
  padding-left: 2.1rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%236c7b73'%3E%3Cpath d='M5 3.5h9a.5.5 0 0 1 0 1H5a.5.5 0 0 1 0-1zm0 4h9a.5.5 0 0 1 0 1H5a.5.5 0 0 1 0-1zm0 4h9a.5.5 0 0 1 0 1H5a.5.5 0 0 1 0-1zM2 3a1 1 0 1 1 0 2 1 1 0 0 1 0-2zm0 4a1 1 0 1 1 0 2 1 1 0 0 1 0-2zm0 4a1 1 0 1 1 0 2 1 1 0 0 1 0-2z'/%3E%3C/svg%3E"),
                    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23495057'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: .7rem center, right .75rem center;
  background-size: 1rem 1rem, .7rem .7rem;
}
/* Tom Select（インクリメンタルサーチ）適用時はアイコンを出さない */
.form-modern .ts-wrapper .form-select { padding-left: .75rem; background-image: none; }

/* チェックボックス: 少し大きめ・テーマ色 */
.form-modern .form-check-input {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: .15rem;
  border-color: #c3d3c9;
}
.form-modern .form-check-input:checked {
  background-color: var(--theme-primary);
  border-color: var(--theme-primary);
}
.form-modern .form-check-label { font-size: .9rem; color: #3d474f; }

/* セクションをカードで区切る（白背景・薄い枠線・広めの余白・はっきりした影） */
.form-modern .form-section {
  background-color: #fff;
  border: 1px solid #e3eae6;
  border-radius: .9rem;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 .35rem 1rem rgba(16, 40, 28, .10), 0 .1rem .25rem rgba(16, 40, 28, .06);
}
.form-modern .form-section:last-of-type { margin-bottom: 1.75rem; }
/* セクション内の行間もゆったりさせる */
.form-modern .form-section > .row { margin-bottom: 1.25rem; }
.form-modern .form-section > .row:last-child { margin-bottom: 0 !important; }
.form-modern .form-section .form-check { margin-bottom: 0; }
@media (max-width: 575.98px) {
  .form-modern .form-section { padding: 1.25rem 1rem; margin-bottom: 1.5rem; border-radius: .75rem; }
}
/* 見出しの下の余白も少し広げる */
.form-modern .form-section-title,
.search-modern .form-section-title { margin-bottom: 1.5rem; }
/* 送信ボタン列の上に余白 */
.form-modern > .d-flex:last-child { margin-top: .5rem; }

/* ── ラベル前の付箋風カラーバー ──
   関連する項目群（請求書・納品書系 / 契約書系）をひと目で見分けられるように、
   ラベルの先頭に縦長の色付き長方形を付ける。
   使い方: <%= f.label :xxx, '…', class: "form-label label-fusen label-fusen-invoice" %> */
.form-modern .form-label.label-fusen::before {
  content: "";
  display: inline-block;
  width: .3rem;
  height: 1rem;
  border-radius: .15rem;
  margin-right: .45rem;
  vertical-align: -.2rem;
  background-color: #9aa4ad; /* 色指定なしのフォールバック */
}
.form-modern .form-label.label-fusen-invoice::before  { background-color: #8fc31f; } /* 請求書・納品書系: 黄緑 */
.form-modern .form-label.label-fusen-contract::before { background-color: #1d9e8f; } /* 契約書系: 青緑 */

/* ── 一覧テーブルのヘッダー固定（申込関連ページ共通） ──
   .list-scroll でテーブルを縦横スクロールのコンテナにし、thead を上部に固定する。
   固定列（.sticky-col / .sticky-edit）と併用するため z-index はヘッダー側を高くする */
.list-scroll {
  max-height: calc(100vh - 220px);
  overflow: auto;
}
.list-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background-color: var(--theme-head); /* テーブルヘッダー色（下の行が透けないように） */
}
.list-scroll thead th.sticky-col,
.list-scroll thead th.sticky-edit {
  z-index: 6 !important; /* 行方向・列方向とも固定されるセルを最前面に（各画面の個別指定より優先） */
}
/* データ行の固定列はヘッダーより背面（ヘッダーの下をくぐる） */
.list-scroll tbody td.sticky-col,
.list-scroll tbody td.sticky-edit {
  z-index: 2;
}

/* ── 申込一覧（共同事業・強化税制）: 列固定＋横スクロールテーブル（刀管理表と共通デザイン） ── */
.apply-list-table {
  border-collapse: separate;
  border-spacing: 0;
}
.apply-list-table th, .apply-list-table td {
  border-right: 1px solid #dee2e6; /* 縦罫線 */
}
.apply-list-table .sticky-col {
  position: sticky;
  z-index: 2;
  background-color: #fff;
}
.apply-list-table thead .sticky-col {
  z-index: 3;
  background-color: var(--theme-head);
}
.apply-list-table .sticky-edit {
  position: sticky;
  right: 0;
  z-index: 2;
  background-color: #fff;
  border-left: 1px solid #dee2e6;
  box-shadow: -2px 0 3px rgba(0, 0, 0, .06);
}
.apply-list-table thead .sticky-edit {
  z-index: 3;
  background-color: var(--theme-head);
}
/* 固定列（申込No〜代表者名）の位置と幅 */
.apply-list-table .col-no      { left: 0;     min-width: 70px;  max-width: 70px; }
.apply-list-table .col-date    { left: 70px;  min-width: 100px; max-width: 100px; }
.apply-list-table .col-company { left: 170px; min-width: 200px; max-width: 200px;
                                 white-space: normal; word-break: break-all; line-height: 1.35; } /* 刀管理表の契約者名と同じく折り返す */
.apply-list-table .col-rep     { left: 370px; min-width: 140px; max-width: 140px; overflow: hidden; text-overflow: ellipsis;
                                 border-right: 2px solid #adb5bd; box-shadow: 2px 0 3px rgba(0, 0, 0, .06); }
.apply-list-table tbody tr:hover td { background-color: #f1f3f5; }
/* 備考列は共通の 12em/20em の3倍まで広げる（長い備考を折り返さず読めるように）。
   shared/_inline_edit_script の td.inline-edit.inline-notes より詳細度を上げて上書きする */
.apply-list-table td.inline-notes,
.apply-list-table td.inline-edit.inline-notes {
  min-width: 36em;
  max-width: 60em;
}

/* ── 一覧の検索カード（刀管理表と共通デザイン） ── */
.list-search .search-group-title {
  font-size: .8rem;
  font-weight: 600;
  color: #6c757d;
  margin-bottom: .35rem;
}
.list-search .search-range {
  display: flex;
  align-items: center;
  gap: .3rem;
  flex-wrap: nowrap; /* FromTo は常に横並び */
}
.list-search .search-range input[type="date"],
.list-search .search-range input[type="month"] {
  flex: 1 1 0;
  width: 1%;
  min-width: 0;
  max-width: 100%;
}

/* ── バリデーションエラー箇所の赤枠（Railsのfield_with_errorsラッパーを利用） ── */
.field_with_errors { display: contents; }
.field_with_errors .form-control,
.field_with_errors .form-select,
.field_with_errors .form-check-input { border-color: #dc3545; }
.field_with_errors .form-control:focus,
.field_with_errors .form-select:focus {
  border-color: #dc3545;
  box-shadow: 0 0 0 .25rem rgba(220, 53, 69, .25);
}

/* レポート「期間が重なる目標」: 目標セットごとの区切りを分かりやすくする */
.report-target-table tbody tr.target-set-start > td { border-top: 2px solid var(--theme-primary); }
.report-target-table tbody tr.target-set-start > td:first-child { background-color: #f3f9f4; }

/* レポート「期間が重なる目標」: 実績/目標を縦積みで桁を揃え、達成率をバーで見せる */
.report-target-table .target-metric { min-width: 240px; max-width: 300px; }
.report-target-table .target-metric-line { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; }
.report-target-table .target-metric-label { color: #6c757d; font-size: .72rem; flex: none; }
.report-target-table .target-metric-num { font-variant-numeric: tabular-nums; font-size: .9rem; }
.report-target-table .target-metric-rate { flex: none; width: 3.8rem; text-align: right; font-size: .8rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── 検索条件（全一覧画面共通）: フォーム画面（form-modern）と同じトーンに揃える ──
   既存マークアップの form-control-sm / btn-sm / small ラベルをここで通常サイズに戻すため、
   各画面は form_with に .search-modern を付けるだけでよい */
.search-modern {
  background: #fff;
  border-radius: .75rem;
  box-shadow: 0 .35rem 1rem rgba(16, 40, 28, .10);
  padding: 1.5rem;
  margin-bottom: 2rem;
}
/* 既にカードを内包している検索フォーム（list-search / katana-search）は二重カードにしない
   （Bootstrapの .shadow / .shadow-sm は !important のためこちらも !important で打ち消す） */
.search-modern .card {
  border: none;
  box-shadow: none !important;
  border-radius: 0;
  background: transparent;
}
.search-modern .card .card-body { padding: 0; }

/* グリッドの余白はフォーム画面と同じ広さに（row g-2 を上書き） */
.search-modern .row { --bs-gutter-x: 1rem; --bs-gutter-y: 1rem; }

/* ラベル: form-modern と同じ太字グレー（text-muted の !important に勝つため色も !important） */
.search-modern .form-label {
  font-size: .82rem;
  font-weight: 600;
  color: #55606a !important;
  margin-bottom: .35rem;
}
.search-modern .search-group-title {
  font-size: .85rem;
  font-weight: 700;
  color: var(--theme-primary);
  margin-bottom: .5rem;
}

/* 入力欄: -sm を通常サイズに戻し、form-modern と同じ角丸・枠線・フォーカス色 */
.search-modern .form-control,
.search-modern .form-select {
  border-radius: .5rem;
  border-color: #dfe5e2;
  padding: .5rem .75rem;
  font-size: .95rem;
  min-height: calc(1.5em + 1rem + 2px);
  background-position: right .75rem center;
}
.search-modern .form-control:hover,
.search-modern .form-select:hover { border-color: #c3d3c9; }
.search-modern .form-control:focus,
.search-modern .form-select:focus {
  border-color: var(--theme-primary-mid);
  box-shadow: 0 0 0 .18rem rgba(var(--theme-rgb-mid), .18);
}
.search-modern .form-control::placeholder { color: #b6bfc6; }
.search-modern .form-check-label { font-size: .9rem; }

/* ボタン: btn-sm を通常サイズに戻す */
.search-modern .btn-sm {
  padding: .45rem 1.1rem;
  font-size: .95rem;
  border-radius: .5rem;
}

/* FromTo は常に横並び（折り返し禁止）。列幅に合わせて入力を縮める */
.search-modern .search-range { display: flex; align-items: center; gap: .3rem; flex-wrap: nowrap; }
.search-modern .search-range input[type="date"],
.search-modern .search-range input[type="month"] {
  flex: 1 1 0;
  width: 1%; /* Safariは日付系inputが固有幅を持ち flex だけでは縮まないため明示 */
  min-width: 0;
  max-width: 100%;
}

/* ── 一覧テーブルの密度調整 ── */
/* チップ（バッジ）の余白を詰めて列幅を稼ぐ */
.list-scroll .badge,
.apply-list-table .badge,
.fee-table .badge {
  padding: .22em .5em;
  font-size: .72rem;
  font-weight: 600;
}
/* ── 一覧テーブルの文字サイズ・配置（申込関連・刀管理表・代理店手数料管理表） ──
   ・文字は 10pt に統一
   ・セルは上下中央
   ・中央揃えの列（金額以外の数字・日付・チェック）は値どうしがくっつかないよう左右に10pxの余白 */
.apply-list-table,
.katana-table,
.fee-table {
  font-size: 10pt;
}
.apply-list-table > :not(caption) > * > *,
.katana-table > :not(caption) > * > *,
.fee-table > :not(caption) > * > * {
  vertical-align: middle;
}
/* インライン編集中の入力欄も同じ 10pt（編集の前後で文字の大きさが変わらないように） */
.apply-list-table .form-control, .apply-list-table .form-select,
.katana-table .form-control, .katana-table .form-select,
.fee-table .form-control, .fee-table .form-select {
  font-size: 10pt;
}
.apply-list-table > :not(caption) > * > .text-center,
.katana-table > :not(caption) > * > .text-center,
.fee-table > :not(caption) > * > .text-center {
  padding-left: 10px;
  padding-right: 10px;
}

/* ヘッダーは中央揃え・上下中央（2行見出しも揃うように） */
.list-scroll thead th,
.apply-list-table thead th,
.fee-table thead th {
  line-height: 1.25;
  vertical-align: middle;
  text-align: center !important;
}

/* 申込一覧: 契約書依頼のチップ */
.badge-req-concluded       { background-color: #9e0f0f; color: #fff; }    /* 契約書締結 */
.badge-req-sent-to-client  { background-color: #cce4fb; color: #1667c9; } /* クライアント様送付 */
.badge-req-adinte-drafting { background-color: #1e7145; color: #fff; }    /* アドインテ様作成中 */
.badge-req-adinte-drafted  { background-color: #fbe38e; color: #6b5500; } /* アドインテ様作成済み */
/* 申込一覧: 請求書・納品書のチップ（送付=水色 / 作成済み=黄 / 作成中=濃緑） */
.badge-inote-client          { background-color: #cce4fb; color: #1667c9; }
.badge-inote-client-created  { background-color: #fbe38e; color: #6b5500; }
.badge-inote-client-creating { background-color: #1e7145; color: #fff; }

/* ── レポート: グラフの表示切替ボタン（Chart.jsの小さな凡例の代わり。指でも押せる大きさ） ── */
.chart-toggles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem;
  margin-bottom: .75rem;
}
.chart-toggle {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 40px;
  padding: .45rem 1rem;
  border-radius: 999px;
  border: 1.5px solid #cfd8d2;
  background: #fff;
  color: var(--theme-head-ink);
  font-size: .88rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.chart-toggle:hover { background: #f3f9f4; border-color: #9fc4ad; }
.chart-toggle:focus-visible { outline: 3px solid rgba(var(--theme-rgb-mid), .35); outline-offset: 2px; }
.chart-toggle .chart-toggle-swatch {
  width: 22px;
  height: 0;
  border-top: 3px solid currentColor;
  border-radius: 2px;
  flex: none;
}
.chart-toggle .chart-toggle-swatch.is-dashed { border-top-style: dashed; }
.chart-toggle .chart-toggle-swatch.is-block { height: 14px; width: 14px; border: none; border-radius: 3px; background: currentColor; }
.chart-toggle.is-off {
  background: #f1f3f4;
  border-color: #dfe3e6;
  color: #8a949c;
  text-decoration: line-through;
}
.chart-toggle.is-off .chart-toggle-swatch { opacity: .35; }
.chart-toggle .chart-toggle-state {
  font-size: .72rem;
  font-weight: 700;
  padding: .1rem .45rem;
  border-radius: 999px;
  background: var(--theme-primary);
  color: #fff;
}
.chart-toggle.is-off .chart-toggle-state { background: #adb5bd; }

/* ── メインコンテンツ幅: 画面サイズに合わせて可変 ──
   固定幅の .container をやめ、全幅ベースに左右の余白だけ確保する。
   スマホ〜小さいウインドウでは従来の container と同等の余白（1rem）、
   画面が広いほど余白は緩やかに増える（2vw）が、中央領域は画面幅に追従する。 */
.app-main-container {
  padding-left: max(1rem, 2vw);
  padding-right: max(1rem, 2vw);
}

/* 申込一覧: スマホ幅では左固定列（申込No〜代表者名で約510px）が横幅を埋めてしまうため
   「横方向」の固定だけ解除する（.list-scroll によるヘッダー行の縦固定は維持） */
@media (max-width: 767.98px) {
  .apply-list-table tbody .sticky-col { position: static; }
  .apply-list-table thead .sticky-col { left: auto; }
  .apply-list-table .col-company { min-width: 160px; max-width: 200px; }
}
