@import url('https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@400;500;700&family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@100..900&display=swap');

:root {
  --color-primary: #425BA8;
  --color-primary-active: #3B82F6;

  --color-text-main: #343C6A;
  --color-text-sub: #5B6F8C;
  --color-text-black: #333333;

  --color-white: #FFFFFF;

  --color-link: #3B82F6;

  --color-border: #C9D7ED;

  --color-bg-control: #F8FAFC;
  --color-bg-menu-hover: #E5F1FD;
  --color-bg-list-hover: #EDF0F6;

  --color-error: #E20025;

  --color-red-button: #EF4444;
  --color-red-bg: #FEF2F2;

  --color-green: #49B778;
  --color-green-bg: #DCFCE7;

  --color-orange: #EF8E1F;
  --color-yellow-bg: #FEF3C7;
  --color-yellow-border: #F8E098;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* iPad等でのダブルタップ拡大をアプリ全体で無効化する(ピンチズームは維持) */
  touch-action: manipulation;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: "Roboto", "Noto Sans JP", sans-serif;
  color: var(--color-text-main);
}

/* モーダル表示中は背面ページをスクロールさせない */
body.is-modal-open {
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

/* =========================================================
  ヘッダー
========================================================= */
.site-header {
  width: 100%;
  height: 85px;
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: 1304px;
  margin: 0 auto;
  padding: 0 32px;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--color-text-main);
  text-decoration: none;
}

.site-logo__mark {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.site-logo__text {
  font-size: 24px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.account-area {
  position: relative;
  min-width: 180px;
  text-align: right;
}

.account-button {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  height: 42px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-main);
  font-size: 16px;
  font-weight: 500;
}

.account-button__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
}

.account-button__icon img {
  display: block;
  width: 42px;
  height: 42px;
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 100;
  min-width: 180px;
  padding: 6px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-white);
  box-shadow: 0 12px 28px rgba(52, 60, 106, 0.14);
}

.account-menu__item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-main);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
}

.account-menu__item[hidden] {
  display: none;
}

.account-menu__item:hover {
  background: var(--color-bg-menu-hover);
}

.account-menu__item--danger {
  color: var(--color-error);
}

.account-menu__item--danger:hover {
  background: var(--color-red-bg);
}

/* =========================================================
  レイアウト
========================================================= */

.page {
  min-height: calc(100vh - 85px);
  padding: 30px 32px;
  background: #f5f7fb;
}

.page__inner {
  max-width: 1240px;
  margin: 0 auto;
}


.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.page-heading button{
  width: 218px;
}

.page-title {
  position: relative;
  display: block;
  min-height: 40px;
  margin: 0;
  padding-top: 3px;
  padding-left: 16px;
  color: var(--color-text-main);
  font-size: 26px;
  line-height: 1.4;
  font-weight: 700;
}

.page-title::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 40px;
  background: var(--color-primary);
}

/* 戻るリンク */
.page-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
  color: var(--color-primary);
  font-size: 14px;
  font-weight: 500;
  text-decoration: underline;
}

/* 戻るリンクアイコン */
.page-back-link__icon {
  display: block;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.page-back-link[hidden],
.page-heading[hidden],
.list-card[hidden] {
  display: none;
}

/* =========================================================
  共通ボタン
========================================================= */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 42px;
  padding: 0 18px;
  border: none;
  border-radius: 4px;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  line-height: 1;
}

.button--primary {
  background: var(--color-primary);
  color: var(--color-white);
}

.button--primary:hover {
  background: var(--color-primary-active);
}

.button--secondary {
  border: 1px solid var(--color-border);
  background: var(--color-white);
  color: var(--color-text-sub);
}

.button--secondary:hover {
  background: var(--color-bg-control);
}

.button--danger {
  border-color: var(--color-red-button);
  background: var(--color-red-button);
  color: var(--color-white);
}

.button--danger:hover {
  opacity: 0.85;
}

.button__icon {
  display: block;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}

.button[hidden] {
  display: none;
}

/* =========================================================
  アクションメニュー
========================================================= */

/* 3点メニューの配置 */
.action-menu {
  position: relative;
  display: inline-flex;
  justify-content: center;
}

/* 3点メニューのボタン */
.action-menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

/* 3点メニューのボタンフォーカス */
.action-menu-button:focus,
.action-menu-button:focus-visible {
  outline: none;
}

/* 3点メニューのアイコン */
.action-menu-button img {
  display: block;
  width: auto;
  height: auto;
  pointer-events: none;
}

/* 3点メニュー表示中・ホバー時 */
.action-menu-button:hover,
.action-menu-button[aria-expanded="true"] {
  background: var(--color-bg-menu-hover);
}

/* 3点メニューの中身 */
.action-menu__panel {
  position: fixed;
  z-index: 1000;
  min-width: 118px;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-white);
  box-shadow: 0 2px 6px 0 rgba(27, 24, 61, 0.3);
}

/* 3点メニュー内のボタン */
.action-menu__item {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--color-primary-active);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

/* 3点メニュー内ボタンのホバー表示 */
.action-menu__item:hover {
  background: var(--color-bg-menu-hover);
}

/* メニュー上では削除項目も青文字にする */
.action-menu__item--danger {
  color: var(--color-primary-active);
}

.data-table tbody tr.is-selected,
.data-table tbody tr.is-selected:hover {
  background: var(--color-bg-menu-hover);
}

/* =========================================================
  共通モーダル
========================================================= */

/* モーダル背景 */
.modal-overlay {
  position: fixed;
  inset: 0;
  /*
    バージョン校正画面のオブジェクト操作メニュー・選択枠(999998)・
    そこから開く詳細パネル(999999)は、赤字まとめ用バージョンで
    新しいレイヤーのcanvasに隠れないよう高いz-indexにしてあるため、
    モーダルは常に最前面になるようそれより確実に大きい値にする
  */
  z-index: 1000000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
  padding: calc(85px + 24px) 24px 24px;
  background: transparent;
}

/* オーバーレイ背景を固定表示する */
.modal-overlay::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(0, 0, 0, 0.35);
}

/* 非表示時 */
.modal-overlay[hidden] {
  display: none;
}

/* モーダル本体 */
.modal-card {
  position: relative;
  width: 100%;
  margin: 0 auto 24px;
  border-radius: 8px;
  background: var(--color-white);
  box-shadow: 0 20px 48px rgba(52, 60, 106, 0.22);
}

.modal-card--sm {
  max-width: 450px;
  padding: 28px 36px 28px;
}

.modal-title {
  margin: 0 0 28px;
  color: var(--color-text-sub);
  font-size: 16px;
  line-height: 1.5;
  font-weight: 500;
  text-align: center;
}

.modal-close-button {
  position: absolute;
  top: 22px;
  right: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
}

.modal-confirm-text {
  margin: 18px 0 8px;
  color: var(--color-text-black);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.6;
  text-align: center;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-form .form-field {
  margin: 0;
}

.modal-form .form-field label {
  display: block;
  margin-bottom: 5px;
  color: var(--color-text-black);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 600;
}

.modal-form .form-field input[type="text"],
.modal-form .form-field input[type="password"] ,
.modal-form .form-field input[type="email"] {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-white);
  color: var(--color-text-black);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.modal-form .form-field input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(67, 94, 180, 0.12);
}

.modal-form .label-note {
  margin-left: 6px;
  color: var(--color-text-sub);
  font-size: 12px;
  font-weight: 400;
}

.form-message {
  color: var(--color-text-sub);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
}

.form-message.is-error {
  color: var(--color-error);
}

.form-message.is-success {
  color: var(--color-green);
}

.radio-group {
  display: flex;
  gap: 25px;
}

.modal-form .form-field .radio-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-main);
  font-size: 15px;
  line-height: 1.5;
  font-weight: 400;
  cursor: pointer;
}

/* 標準ラジオを見えなくする */
.modal-form .form-field .radio-item input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* 外側の丸 */
.modal-form .form-field .radio-item span {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding-left: 28px;
}

/* 未選択の丸 */
.modal-form .form-field .radio-item span::before {
  content: "";
  position: absolute;
  left: 0;
  width: 20px;
  height: 20px;
  border: 2px solid #b7c6dc;
  border-radius: 50%;
  background: #fff;
  box-sizing: border-box;
}

/* 選択時の内側の青丸 */
.modal-form .form-field .radio-item input[type="radio"]:checked + span::after {
  content: "";
  position: absolute;
  left: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-primary-active);
}

.modal-footer {
  display: flex;
  gap: 18px;
  margin-top: 8px;
  padding-top: 26px;
  border-top: 1px solid #d8e2f1;
  justify-content: center;
}

.modal-footer .button {
  flex: 1;
  font-size: 16px;
  max-width: 160px;
}

/* ＝＝＝ チェックボックス ＝＝＝ */

/* チェックボックス一覧 */
.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
  max-height: 195px;
  overflow-y: auto;
}

/* チェックボックス行 */
.checkbox-item {
  display: inline-flex;
  align-items: center;
  color: var(--color-text-black);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
}

/* 標準チェックボックスを非表示 */
.checkbox-item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* ラベル文字 */
.checkbox-item span {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding-left: 30px;
  font-weight: 400;
}

/* 未選択の四角 */
.checkbox-item span::before {
  content: "";
  position: absolute;
  left: 0;
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-radius: 3px;
  background: var(--color-white);
  box-sizing: border-box;
}

/* 選択時の背景 */
.checkbox-item input[type="checkbox"]:checked + span::before {
  border-color: var(--color-primary-active);
  background: var(--color-primary-active);
}

/* 選択時のチェックマーク */
.checkbox-item input[type="checkbox"]:checked + span::after {
  content: "";
  position: absolute;
  left: 6px;
  margin-top: -5px;
  width: 6px;
  height: 10px;
  border-right: 2px solid var(--color-white);
  border-bottom: 2px solid var(--color-white);
  border-radius: 1px;
  transform: rotate(45deg);
}

/* 親フォルダで無効な担当者をグレーアウトする */
.checkbox-item.is-disabled {
  color: var(--color-text-sub);
  opacity: 0.45;
  cursor: not-allowed;
}

.checkbox-item.is-disabled input,
.checkbox-item.is-disabled span {
  cursor: not-allowed;
}

/* 親フォルダで無効な次の作業者候補をグレーアウトする */
.custom-select__option.is-disabled {
  color: var(--color-text-sub);
  opacity: 0.45;
  cursor: not-allowed;
}

/* ＝＝＝ ファイル選択 ＝＝＝ */

/*
  ファイル選択の外枠（ドラッグ&ドロップ領域を兼ねる）
  「.modal-form .form-field label」の汎用スタイル（display:block等）に
  上書きされないよう、同等以上の詳細度で指定する
*/
.modal-form .form-field .file-select {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin-bottom: 0;
  padding: 14px 16px;
  border: 2px dashed var(--color-border);
  border-radius: 8px;
  color: var(--color-text-sub);
  font-weight: 400;
  text-align: left;
  transition: border-color .15s ease, background-color .15s ease;
}

/* 標準のファイル入力を非表示にする */
.file-select input[type="file"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* ファイル選択ボタンとドラッグ&ドロップ案内を横並びにする */
.file-select__row {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ファイル選択ボタン */
.file-select__button {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-bg-control);
  color: var(--color-text-main);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

/* ファイル選択ボタンのホバー・キーボードフォーカス */
.file-select__button:hover,
.file-select__button:focus-visible {
  border-color: var(--color-primary);
  background: var(--color-bg-menu-hover);
}

/* 選択中のファイル名 */
.file-select__text {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  color: var(--color-text-sub);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ドラッグ&ドロップの案内文 */
.file-select__hint {
  color: var(--color-text-sub);
  font-size: 12px;
}

/* ドラッグ中のファイル選択欄 */
.modal-form .form-field .file-select.is-dragover {
  border-color: var(--color-primary);
  background: var(--color-bg-menu-hover);
}

/* ファイル追加ボタンと案内文をさりげなく並べる */
.file-add-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/*
  ページ内へのファイルドラッグ中は、実際にファイルが並ぶ一覧カードの枠を
  点線に変える（.list-cardは元々2px実線なので、幅は変えず色と線種だけ変更）
*/
.page__inner.is-dragover .list-card {
  border-color: var(--color-primary);
  border-style: dashed;
  background: var(--color-bg-menu-hover);
}


/* =========================================================
  共通確認モーダル
========================================================= */

/* 削除確認など横幅が広いモーダル */
.modal-card--delete {
  max-width: 600px;
}

/* 削除対象名などを中央に大きく表示する */
.modal-target-name {
  margin: 0 0 34px;
  color: var(--color-text-black);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}

/* 削除確認などの警告エリア */
.modal-alert-box {
  margin: 0 0 30px;
  padding: 22px 20px;
  border-radius: 4px;
  background: #fff0f1;
  color: var(--color-error);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.8;
  text-align: center;
}

/* 警告エリアの主文 */
.modal-alert-box__main {
  margin-bottom: 4px;
  font-size: 18px;
  font-weight: 600;
}

/* =========================================================
  共通カスタムプルダウン
========================================================= */

/* カスタムプルダウンの外枠 */
.custom-select {
  position: relative;
}

/* カスタムプルダウンの表示ボタン */
.custom-select__button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 44px;
  padding: 0 18px 0 14px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-white);
  color: var(--color-primary-active);
  font-size: 15px;
  font-weight: 400;
  cursor: pointer;
}

/* カスタムプルダウンのホバー表示 */
.custom-select__button:hover {
  border-color: var(--color-primary-active);
}

/* 選択中テキストの省略表示 */
.custom-select__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* プルダウン矢印 */
.custom-select__arrow {
  width: 10px;
  height: 10px;
  margin-left: 12px;
  border-right: 2px solid var(--color-primary-active);
  border-bottom: 2px solid var(--color-primary-active);
  transform: rotate(45deg) translateY(-3px);
  font-size: 0;
  flex-shrink: 0;
}

/* カスタムプルダウンの選択パネル外枠 */
.custom-select__panel {
  position: absolute;
  top: calc(100% + 4px);
  bottom: auto;
  left: 0;
  right: 0;
  z-index: 10000;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-white);
  box-shadow: 0 2px 6px 0 rgba(27, 24, 61, 0.3);
  overflow: hidden;
}

.custom-select__panel-scroll {
  max-height: 210px;
  padding: 8px;
  background: var(--color-white);
  overflow-y: auto;
  overflow-x: hidden;
}

/* 検索付きプルダウンだけ高さを固定する */
.custom-select--searchable .custom-select__panel-scroll {
  height: 210px;
}

/* 下に余裕がない場合は上に開く */
.custom-select.is-dropup .custom-select__panel {
  top: auto;
  bottom: calc(100% + 4px);
}

/* カスタムプルダウン内の検索入力欄 */
.custom-select__search {
  width: 100%;
  height: 36px;
  margin-bottom: 6px;
  padding: 0 10px;
  border: 1px solid #b7c6dc;
  border-radius: 4px;
  color: var(--color-text-black);
  font-size: 14px;
}

/* カスタムプルダウンの選択肢 */
.custom-select__option {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--color-text-black);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

/* hidden属性が付いた選択肢は非表示にする */
.custom-select__option[hidden] {
  display: none;
}

/* 選択肢のホバー・選択中表示 */
.custom-select__option:hover,
.custom-select__option.is-active {
  background: var(--color-bg-list-hover);
  color: var(--color-primary-active);
}

/* カスタムプルダウンを複数行並べる */
.custom-select-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* =========================================================
  共通テーブル
========================================================= */

/* 一覧カード */
.list-card {
  overflow: hidden;
  padding: 18px 32px 16px;
  border: 2px solid #DFEAF2;
  border-radius: 6px;
  background: var(--color-white);
  box-shadow: none;
}

/* 一覧カード内の横スクロール枠 */
.list-card .data-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  color: var(--color-text-main);
  font-size: 14px;
}

.data-table thead {
  background: transparent;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid #d8e2f1;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  padding: 10px 12px 10px;
  color: var(--color-primary);
  font-size: 14px;
  font-weight: 700;
}

.data-table td {
  padding: 14px 12px;
}

.data-table tbody tr:hover {
  background: var(--color-bg-list-hover);
}

/* ソート可能なヘッダーセル */
.data-table th.sortable-th {
  padding: 0;
}

.sortable-th:hover {
  background: var(--color-bg-list-hover);
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: auto;
  border: none;
  background: transparent;
  color: var(--color-primary);
  font: inherit;
  font-weight: 700;
  text-align: left;
  padding: 10px 12px 10px;
}

.sort-button__icon {
  display: block;
  width: 22.5px;
  height: 18px;
  flex: 0 0 auto;
}

/* =========================================================
  ユーティリティ
========================================================= */
.visually-hidden {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 768px) {
  .site-header__inner {
    padding: 0 18px;
  }

  .page {
    padding: 26px 18px 36px;
  }

  .page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .page-heading button{
    width: 100%;
  }

  .modal-card--sm {
    max-width: 100%;
    padding: 26px 24px;
  }

  .modal-close-button {
    top: 20px;
    right: 20px;
  }

  .modal-footer {
    flex-direction: column-reverse;
  }

  .modal-footer .button{
    flex: none;
    max-width: 100%;
  }
}