/* ===== 全体設定（フォント・背景など） ===== */
html, body {
    margin: 0; /* 上下左右の余白 */
    padding: 0; /* 内側の余白 */
    height: 100vh; /* ブラウザの高さ使用率(vh=%) */
    overflow-x: hidden; /* 横スクロールを出さない */
    font-family: sans-serif; /* 全体のフォントをシンプルに設定 */
}


/* ===== レイアウト：左右分割のフレックスボックス ===== */
.container {
    display: flex; /* 左右分割にするflexbox設定 */
    height: 100vh; /* 画面全体の高さ */
}


/* ===== サイドバー設定 ===== */
.sidebar {
    position: fixed; /* 位置固定 */
    top: 0; /* 最上部に固定 */
    left: 0; /* 左端に固定 */
    width: 170px; /* 横幅ピクセル指定 */
    height: 100vh; /* 画面全体の高さに合わせる */
    background-color: #f0f0f0; /* 背景色 */
    padding: 20px; /* 中身と端の余白 */
    box-sizing: border-box; /* 指定した横幅に収める指定 */
}

.sidebar h1 {
    font-size: 18px; /* サイドバー内のタイトル文字サイズ */
}

.sidebar ul {
    list-style: none; /* リストマークを消す */
    padding-left: 0; /* 左余白をゼロに */
}

.sidebar li {
    margin: 10px 0; /* 各メニュー項目の間隔 */
}

.sidebar a {
    text-decoration: none; /* リンク下線を消す */
    color: #333; /* リンク文字色を濃いグレーに */
    transition: all 0.2s ease; /* 変化にアニメーションを追加 */
}

.sidebar a:hover {
    color: white;              /* マウスを乗せた時の文字色 */
    background-color: #a3a3a3;    /* 背景を濃くする */
    padding: 4px 8px;          /* 少し余白を追加 */
    border-radius: 4px;        /* 角を丸くする */
}

/* ===== メインコンテンツエリアのデザイン ===== */
.content {
    margin-left: 170px; /* サイドバーを避けて表示させる */
    flex-grow: 1; /* サイドバー以外の部分を広げる */
    padding: 0 10px 10px 10px; /* 内側の余白(上 右 下 左) */
    background-color: #fff; /* 背景色 */
    font-size: 0.8em; /* 文字サイズを変更 */
    color: #252525; /* 文字色 */
    display: flex; /* 上下分割用flexbox */
    flex-direction: column; /* 上下に並べる */
}

/* 横線 */
hr {
    border: none;
    border-top: 1px solid #ccc;
    margin: 10px 0;
    height: 0;
}

/* 段落 */
p {
  margin: 5px 0;
}

/* リンクの下線 */
a {
  text-decoration: none;
}


/* ===== ヘッダーのデザイン ===== */
.page-header {
    background-color: #535353; /* 背景色 */
    color: white; /* 文字色 */
    padding: 3px; /* 上下左右の内側余白 */
    text-align: center; /* 文字を中央揃え */
    font-size: 1.2em; /* 文字サイズ：標準 */
    margin-bottom: 20px; /* ヘッダーの下に余白を作る */
}


/* ===== 検索フォームのデザイン ===== */

.search-header {
    display: flex;
    justify-content: space-between; /* 左:フォーム, 右:ボタン */
    align-items: center; /* 縦方向中央揃え */
    padding: 0 30px 0 0; /* 上 右 下 左 */
}

.form-row {
    display: flex;
    flex-wrap: wrap; /* 折り返しOK */
    align-items: center; /* 縦方向中央揃え */
    padding: 0 30px 0 20px; /* 上 右 下 左 */
    gap: 15px;            /* 要素同士の隙間 */
    margin-bottom: 10px;  /* 次の行との間隔 */
    flex: 0 1 auto;
}

.form-row a {
    text-decoration: none; /* 🔥 リンク下線を消す */
}

/* 日付入力欄の共通幅 */
.flatpickr {
    width:82px; /* 幅指定 */
    text-align: center; /* 左右中央揃え */
}

/* ページャー機能 */
.pagination {
    margin: 0 15px;
    text-align: right;
}
.pagination a {
    text-decoration: none;
    color: #007bff;
}
.pagination strong {
    font-weight: bold;
    background-color: #ffffcc;
    padding: 2px 6px;
}


/* ===== テーブル全体の枠線と中央配置 ===== */
table {
    border-collapse: collapse; /* セルの隙間をなくす */
    width: 100%; /* テーブル幅を最大に */
}

th, td {
    border: 1px solid #aaa; /* 枠線を薄めのグレーに */
    padding: 4px; /* セル内余白 */
    text-align: center; /* 左右中央揃え */
    vertical-align: middle; /* 上下中央揃え */
}

/* ヘッダー色指定 */
th {
    background-color: #cadef7;
    color: #333;
}

/* 偶数・奇数行の背景（tbodyだけに適用） */
table tbody tr:not(.bg-custom):nth-child(even) td {
    background-color: #f9f9f9;
}
table tbody tr:not(.bg-custom):nth-child(odd) td {
    background-color: #ffffff;
}

/* リンクの色とホバー時 */
table a {
    color: #1a68bd;
}
table a:hover {
    color: #007bff;
    text-decoration: underline;
}

/* スクロール時テーブルヘッダー固定 */
.scrollable-table-wrapper thead th {
    position: sticky;
    top: 0;                      /* 上端に固定 */
    background-color: #cadef7;  /* 背景を明るめに（重なり時に見やすく） */
    z-index: 10;                 /* 他要素より前に出す */
}

/* スクロール時テーブルヘッダー固定(全体集計ページ用) */
/* 上2行をそれぞれ別々にstickyにする */
.scrollable-table-wrapper thead tr:nth-child(1) th {
  position: sticky;
  top: 0;
  z-index: 11;
  background-color: #cadef7;
}

.scrollable-table-wrapper thead tr:nth-child(2) th {
  position: sticky;
  top: 28px; /* ←1行目の高さ分。必要に応じて調整 */
  z-index: 10;
  background-color: #cadef7;
}

/* テーブル縦スクロール（他のページ共通） */
.scrollable-table-wrapper {
    overflow-y: auto;
}

/* 画像の中央配置とサイズ調整 */
td img {
    display: block; /* ブロック要素化で中央揃え */
    margin: 0 auto; /* 左右中央に配置 */
    max-width: 50px; /* 画像最大横幅 */
    max-height: 50px; /* 画像最大縦幅 */
    object-fit: contain; /* 縦横比を保ちながら収める */
}

/* 削除を赤文字に */
.text-danger {
  color: rgb(223, 2, 2);
}

/* ===== アプリ詳細ページ ===== */

/* アップローダーのサイズ調整 */
.compact-upload input[type="file"] {
  font-size: 9px;
  height: 20px;
  padding: 2px 0px;
}
.compact-upload button {
  font-size: 9px;
  padding: 2px 5px;
}

/* テーブル内のセルのスタイル */
.highlight-cell {
    padding: 4px; /* 上下に4pxの余白 */
    background-color: #cadef7 !important; /* 強制時は!important */
    color: #333;
    font-weight: bold; /* 文字を太字にする */
}

td.left-text {
    text-align: left; /* 文字を左寄せにする */
    padding: 0 0 0 4px; /* 内側の余白(上 右 下 左) */
    vertical-align: middle;
}

/* テキストエリアのスタイル */
.large-textarea {
    height: 100%; /* 高さ */
    min-height: 55px; /* 最低限の高さ */
    width: 100%; /* 幅 */
    box-sizing: border-box; /* ✅ これで幅計算がパーフェクトに！ */
    border: none; /* ボーダー削除 */
    resize: vertical; /* 入力スペース稼働 */
}

/* テーブル縦スクロール（アプリ詳細ページ専用） */
.app-detail-scroll {
    max-height: calc(100vh - 290px);
    overflow-y: auto;
}

/* 削除済み行（グレー文字に統一） */
.deleted-row,
.deleted-row textarea,
.deleted-row select,
.deleted-row input {
    color: #adadad;
}

/* ===== 集計ページ ===== */

/* 合計を太字に */
.fw-bold {
  font-weight: bold !important;
}

/* 合計を色替え */
.bg-custom {
  background-color: #ffe4b5 !important;
}


/* ===== モーダル用 ===== */
.modal {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

.modal-content .plan-select {
  width: 90%;
  max-width: 800px;
}

.close-button {
    float: right;
    font-size: 1.4rem;
    font-weight: bold;
    cursor: pointer;
}


/* ===== 各種編集フォームで使用 ===== */

.form-table textarea {
    width: 90%; /* テキストエリアの横幅 */
    height: 60px;/* 高さを60pxに固定して見た目を統一する */
}

.form-table input[type="text"] {
    width: 60%; /* テキストエリアの横幅 */
    text-align: center; /* 文字を中央寄せにする */
}

.form-table input.calendar-input {
    width: 50%; /* テキストエリアの横幅 */
    text-align: center; /* 文字を中央寄せにする */
}

.form-table input.title-input {
    width: 90% !important;
    text-align: left !important; /* 文字を左寄せにする */
}

.form-table select{
    width: 30%; /* セレクトボックスの横幅 */
    text-align: center; /* 文字を中央寄せにする */
}


/* ===== アプリ登録フォームで使用 ===== */

.app-form-table textarea {
    width: 90%; /* テキストエリアの横幅 */
    height: 60px;/* 高さを60pxに固定して見た目を統一する */
}

.app-form-table input[type="text"] {
    width: 90%; /* テキストエリアの横幅 */
    height: 20px;/* 高さを60pxに固定して見た目を統一する */
}

.app-form-table input.calendar-input {
    width: 30%; /* テキストエリアの横幅 */
    text-align: center; /* 文字を中央寄せにする */
}

.app-form-table select{
    width: 30%; /* セレクトボックスの横幅 */
    text-align: center; /* 文字を中央寄せにする */
}

.content-header-box {
    text-align: center; /* 文字を中央寄せにする */
}


/* ===== デバイス版？ ===== */



/* ===== 汎用 ===== */

/* 特別なボタン */
.custom-warning-btn {
    background-color: #f04e4e73; /* 色指定 */
    text-align: center; /* 文字を中央揃え */
}


.flatpickr-calendar {
  z-index: 10000 !important;
}



/* ===== ログイン ===== */

.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 70vh;
}

.login-box {
  background: #fff;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  width: 320px;
  text-align: center;
}

.login-box h2 {
  margin-bottom: 20px;
  font-size: 20px;
}

.login-box .form-group {
  margin-bottom: 15px;
  text-align: left;
}

.login-box input {
  width: 100%;
  padding: 8px;
  margin-top: 5px;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.btn-login {
  width: 100%;
  padding: 10px;
  background: #2c68a8;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.btn-login:hover {
  background: #0056b3;
}


/* ===== 履歴ページ装飾 ===== */

.bar-cell {
  padding: 0;
  margin: 0;
}

.bar-bg {
  position: relative;
  width: calc(100% - 8px); /* セル幅から左右合計4px引く */
  height: 22px;
  background-color: #f0f0f0;
  border-radius: 3px;
  overflow: hidden;
  margin: 0 4px; /* 左右に4px余白 */
}

.bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background-color: #89b7eb; /* 棒の色（Excel風に青） */
}

.bar-text {
  position: relative;
  text-align: center;
  line-height: 22px;  /* 縦中央揃え */
  font-size: 12px;
  color: black;       /* 文字色（棒が濃い色なら白にしてもOK） */
  z-index: 1;
}