/* ============================================
   グリーム 作業管理システム - 共通スタイル
   ============================================ */

/* --- リセット & ベース --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  height: 100%;
  min-height: 100dvh;
}

body {
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  color: #333;
  background: #e8eaed;
  height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============================================
   メインコンテンツ
   ============================================ */
.main-content {
  flex: 1;
  align-self: stretch;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px;
  background: #e8eaed;
}

/* --- ページヘッダー --- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

/* KDCS_PRJ-393 (D-5): ここにあった .page-title の指定を削除。 components.css で同一セレクタが後から同値で再定義されている（または当該クラスがビューで未使用）ため、削除しても計算値は変わらない。 */

.page-actions {
  display: flex;
  gap: 8px;
}

/* ============================================
   検索フォーム
   ============================================ */
.search-form {
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 12px;
}

.form-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #202124;
  margin-bottom: 12px;
}

.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-inline {
  flex: 1;
  min-width: 300px;
}

.form-full-width {
  flex: 1 1 100%;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: #5f6368;
  min-width: 70px;
  flex-shrink: 0;
}

.form-control {
  height: 32px;
  padding: 0 10px;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-size: 13px;
  color: #333;
  background: #fff;
  transition: border-color 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

.form-control-sm {
  width: 120px;
}

.form-control-lg {
  flex: 1;
  min-width: 200px;
}

.form-select-sm {
  width: 140px;
  cursor: pointer;
}

.form-separator {
  color: #5f6368;
  font-size: 13px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #5f6368;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  cursor: pointer;
}

.error-message {
  font-size: 12px;
  color: #d93025;
  min-height: 16px;
}

/* --- フォームアクション --- */
.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #f1f3f4;
  margin-top: 8px;
}

.htmx-indicator {
  font-size: 13px;
  color: #1a73e8;
  font-weight: 500;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ============================================
   ステータスフィルタ
   ============================================ */
.status-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  background: #fff;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #dadce0;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: #e8eaed;
  border: none;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  color: #5f6368;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn:hover {
  background: #dadce0;
}

.filter-btn.active {
  background: #1a73e8;
  color: #fff;
}

/* ============================================
   テーブルヘッダーバー
   ============================================ */
.table-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  margin-top: 12px;
  padding: 0 4px;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: #202124;
}

.section-title small {
  font-size: 11px;
  color: #5f6368;
  font-weight: 400;
  margin-left: 8px;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-info {
  font-size: 11px;
  color: #5f6368;
}

/* ============================================
   データテーブル共通
   ============================================ */
.ledger-list-container,
.work-detail-container {
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table thead {
  background: #f1f3f4;
  border-bottom: 1px solid #dadce0;
}

/* KDCS_PRJ-393 (D-5): ここにあった .data-table thead th の指定を削除。 components.css で同一セレクタが後から同値で再定義されている（または当該クラスがビューで未使用）ため、削除しても計算値は変わらない。 */

.data-table thead th:last-child {
  border-right: none;
}

.data-table tbody tr {
  border-bottom: 1px solid #f1f3f4;
  transition: background 0.1s;
}

.data-table tbody tr:hover {
  background: #f8f9fa;
}

/* PRJ-236: 行クリックで編集遷移できる行にポインタカーソルを表示 */
/* KDCS_PRJ-401: 行に付けた .lm-row-clickable をやめ、鉛筆リンク・展開ボタンの
   目印から導出する。遷移可否・展開可否の条件が操作列の1箇所だけになり、
   行側との二重管理が起きない。> td 限定は展開行の中に入れ子のテーブルが
   描画される画面で、内側の行を巻き込まないため。 */
tbody tr:has(> td a[data-lm-row-link]),
tbody tr:has(> td button[data-lm-row-toggle]) {
  cursor: pointer;
}

.data-table tbody td {
  padding: 8px 10px;
  vertical-align: middle;
  white-space: nowrap;
  border-right: 1px solid #f1f3f4;
}

.data-table tbody td:last-child {
  border-right: none;
}

.text-right {
  text-align: right;
}

/* --- カラム幅ヒント --- */
.col-checkbox {
  width: 40px;
  text-align: center;
}

.checkbox-all {
  cursor: pointer;
}

.col-number { width: 110px; }
.col-code { width: 100px; }
.col-client { width: 100px; }
.col-name { min-width: 180px; max-width: 250px; }
.col-name-sm { width: 100px; }
.col-date { width: 100px; }
.col-date-sm { width: 90px; }
.col-amount { width: 120px; }
.col-staff { width: 90px; }
.col-status { width: 80px; }
.col-actions {
  width: 100px;
  text-align: center;
}

.actions-cell {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.btn-action {
  background: none;
  border: none;
  color: #5f6368;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.15s;
}

.btn-action:hover {
  background: #f1f3f4;
  color: #1a73e8;
}

/* --- ステータスバッジ --- */
.status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.status-in-progress {
  background: #e3f2fd;
  color: #1565c0;
}

.status-not-started {
  background: #f5f5f5;
  color: #616161;
}

.status-paused {
  background: #fff3e0;
  color: #e65100;
}

.status-waiting {
  background: #e8f5e9;
  color: #2e7d32;
}

.status-completed {
  background: #e0f2f1;
  color: #00695c;
}

.status-cancelled {
  background: #ffebee;
  color: #c62828;
}

/* --- 0件メッセージ --- */
.empty-message {
  padding: 40px 20px;
  text-align: center;
  color: #9aa0a6;
  font-size: 13px;
}

/* ============================================
   ページネーション
   ============================================ */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px 0;
}

.pagination-controls {
  display: flex;
  gap: 2px;
}

.btn-page {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  background: #fff;
  border: 1px solid #dadce0;
  color: #5f6368;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}

.btn-page:hover:not(:disabled) {
  background: #f8f9fa;
  border-color: #1a73e8;
  color: #1a73e8;
}

.btn-page.active {
  background: #1a73e8;
  border-color: #1a73e8;
  color: #fff;
  font-weight: 600;
}

.btn-page:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================================
   ボタン共通
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: #1a73e8;
  color: #fff;
  border-color: #1a73e8;
}

.btn-primary:hover:not(:disabled) {
  background: #1557b0;
  border-color: #1557b0;
}

.btn-secondary {
  background: #fff;
  color: #5f6368;
  border-color: #dadce0;
}

.btn-secondary:hover:not(:disabled) {
  background: #f8f9fa;
  border-color: #bdc1c6;
}

.btn-success {
  background: #34a853;
  color: #fff;
  border-color: #34a853;
}

.btn-success:hover:not(:disabled) {
  background: #2d8e47;
}

.btn-outline {
  background: #fff;
  color: #5f6368;
  border-color: #dadce0;
}

.btn-outline:hover:not(:disabled) {
  background: #f8f9fa;
  border-color: #bdc1c6;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
}

.btn-icon-sm {
  padding: 4px 6px;
  background: #f8f9fa;
  border: 1px solid #dadce0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  color: #5f6368;
  transition: all 0.15s;
}

.btn-icon-sm:hover {
  background: #e8eaed;
  color: #1a73e8;
}

/* ============================================
   モーダル
   ============================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

[x-cloak] {
  display: none !important;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  position: relative;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  min-width: 450px;
  max-width: 90vw;
  max-height: 85vh;
  overflow: auto;
  animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-content-sm {
  min-width: 400px;
}

.modal-content-lg {
  min-width: 600px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e8eaed;
  background: #f8f9fa;
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: #202124;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #5f6368;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.15s;
}

.modal-close:hover {
  background: #e8eaed;
  color: #202124;
}

.modal-body {
  padding: 20px;
}

.modal-warning {
  color: #d93025;
  font-weight: 600;
  margin-top: 8px;
  font-size: 13px;
}

.modal-note {
  color: #5f6368;
  font-size: 12px;
  margin-top: 8px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid #e8eaed;
  background: #f8f9fa;
}

.btn-danger {
  background: #d93025;
  color: #fff;
  border-color: #d93025;
}

.btn-danger:hover:not(:disabled) {
  background: #b71c1c;
}

/* モーダル内詳細表示 */
.detail-modal-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-row {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px solid #f1f3f4;
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label-modal {
  font-size: 12px;
  font-weight: 600;
  color: #5f6368;
  min-width: 120px;
}

.detail-value-modal {
  font-size: 12px;
  color: #202124;
  flex: 1;
}

/* ファイルプレビュー */
.file-preview-area {
  border: 1px solid #e8eaed;
  border-radius: 6px;
  overflow: hidden;
}

.file-preview-header {
  padding: 10px 12px;
  background: #f8f9fa;
  border-bottom: 1px solid #e8eaed;
}

.file-preview-name {
  font-size: 12px;
  font-weight: 600;
  color: #202124;
}

.file-preview-content {
  padding: 40px;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
}

.file-preview-placeholder {
  color: #9aa0a6;
  font-size: 13px;
}

/* ============================================
   検索フォームヘッダー(折り畳み対応)
   ============================================ */
.search-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.search-form-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-clear-link {
  background: none;
  border: none;
  color: #1a73e8;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  transition: color 0.15s;
}

.search-clear-link:hover {
  color: #1557b0;
}

.search-collapse-btn {
  background: none;
  border: 1px solid #dadce0;
  border-radius: 4px;
  color: #5f6368;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  transition: background 0.15s;
}

.search-collapse-btn:hover {
  background: #f5f5f5;
}

.search-collapse-btn span {
  display: inline-block;
  transition: transform 0.2s;
}

.search-collapse-btn span.collapsed {
  transform: rotate(-90deg);
}

/* ドロップダウン付き小ボタン */
.btn-dropdown-sm {
  height: 32px;
  padding: 0 8px;
  background: #f8f9fa;
  border: 1px solid #dadce0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 10px;
  color: #5f6368;
  transition: all 0.15s;
  flex-shrink: 0;
}

.btn-dropdown-sm:hover {
  background: #e8eaed;
  color: #333;
}

/* フォームコントロール: 中サイズ */
.form-control-md {
  width: 160px;
}

/* ============================================
   テーブルコンテナヘッダー
   ============================================ */
.ledger-container-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e8eaed;
}

/* ============================================
   サブフィルタバー
   ============================================ */
.sub-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f8f9fa;
  border-bottom: 1px solid #e8eaed;
}

.sub-filter-tabs {
  display: flex;
  gap: 4px;
}

.sub-filter-tab {
  padding: 5px 14px;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 12px;
  color: #5f6368;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}

.sub-filter-tab:hover {
  background: #e8eaed;
  color: #333;
}

.sub-filter-tab.active {
  background: #fff;
  color: #1a73e8;
  border-color: #1a73e8;
  font-weight: 600;
}

.sub-filter-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ============================================
   展開可能行 / サブテーブル
   ============================================ */
.row-expandable {
  cursor: pointer;
}

.row-expandable:hover {
  background: #e8f0fe !important;
}

.sub-table-row > td {
  padding: 0 !important;
  background: #f0f4ff;
}

.sub-table-cell {
  padding: 0 !important;
}

.sub-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.sub-table thead {
  background: #d2e3fc;
}

/* KDCS_PRJ-393 (D-5): ここにあった .sub-table th の指定を削除。 components.css で同一セレクタが後から同値で再定義されている（または当該クラスがビューで未使用）ため、削除しても計算値は変わらない。 */

.sub-table th:last-child {
  border-right: none;
}

.sub-table td {
  padding: 5px 10px;
  background: #f0f4ff;
  border-right: 1px solid #d2e3fc;
  border-bottom: 1px solid #d2e3fc;
  white-space: nowrap;
}

.sub-table td:last-child {
  border-right: none;
}

.sub-table tbody tr:hover td {
  background: #e3edff;
}

/* ============================================
   案件種別バッジ
   ============================================ */
.type-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.type-sales {
  background: #e8f0fe;
  color: #1a73e8;
  border: 1px solid #aecbfa;
}

.type-bid {
  background: #fce8e6;
  color: #d93025;
  border: 1px solid #f5c6cb;
}

/* 状況区分バッジ(追加) */
.status-ordered {
  background: #e8f0fe;
  color: #1a73e8;
}

.status-inputting {
  background: #e6f4ea;
  color: #137333;
}

.status-estimate {
  background: #fef7e0;
  color: #ea8600;
}

/* ============================================
   カラム幅追加
   ============================================ */
.col-branch { width: 100px; }
.col-type   { width: 110px; }
.col-more   { width: 36px; text-align: center; }
.col-sales  { width: 100px; }
.col-management { width: 80px; }

/* ソートアイコン */
.sort-icon {
  font-size: 9px;
  color: #9aa0a6;
  margin-left: 2px;
}

/* ページネーション省略記号 */
.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
  color: #5f6368;
  font-size: 12px;
  user-select: none;
}

/* ============================================
   スクロールバー
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f3f4;
}

::-webkit-scrollbar-thumb {
  background: #dadce0;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #bdc1c6;
}

/* ============================================
   詳細画面: 2カラムレイアウト
   ============================================ */
.main-content-split {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 12px;
  padding: 12px;
}

.detail-left-column {
  overflow-y: auto;
}

.detail-right-column {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

/* KDCS_PRJ-393 (D-5): ここにあった .page-title-detail の指定を削除。 components.css で同一セレクタが後から同値で再定義されている（または当該クラスがビューで未使用）ため、削除しても計算値は変わらない。 */

/* アラートバナー */
.alert-banner {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
}

.alert-banner > ul {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding-left: 1.2em;
}

.alert-banner > ul > li {
  line-height: 1.5;
}

.alert-error {
  background: #fce8e6;
  color: #d93025;
  border: 1px solid #f5c6cb;
}

.alert-success {
  background: #e6f4ea;
  color: #137333;
  border: 1px solid #a8dab5;
}

.alert-warning {
  background: #fef7e0;
  color: #ea8600;
  border: 1px solid #fdd663;
}

/* --- グローバルエラートースト --- */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1100;
  max-width: 400px;
}
/* KDCS_PRJ-313: 成功トーストはエラートーストと重ならないよう少し下にオフセット */
.toast-container-success {
  top: 72px;
}

/* --- モーダル内 Tom Select z-index対応 --- */
.modal .ts-dropdown {
  z-index: 1050;
}

/* ============================================
   アカウント設定 / アクセスログ(login.cssから移植)
   認証後auth画面が共通レイアウト移行後もlogin.cssなしで
   同等の表示を維持するための定義。login.css自体は編集しない。
   ============================================ */
.account-main,
.audit-main {
  padding-top: 14px;
}

.account-card {
  max-width: 880px;
}

.account-card-body {
  padding: 16px;
}

.password-settings-body {
  padding: 20px 28px;
}

.account-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.password-settings-form {
  padding: 0 8px;
}

.password-settings-form .account-form-row {
  padding: 0 4px;
  display: grid;
  grid-template-columns: 170px minmax(0, 420px);
  align-items: center;
  gap: 8px;
}

.password-settings-form .account-form-row .account-form-label {
  min-width: 0;
}

.password-settings-form .account-form-row .account-input {
  max-width: none;
}

.account-form-row {
  width: 100%;
  max-width: 700px;
}

.account-form-label {
  min-width: 160px;
}

.account-input {
  width: 100%;
  max-width: 420px;
}

.account-form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.account-note {
  margin-bottom: 10px;
  font-size: 13px;
  color: #4e5968;
}

/* ============================================
   詳細フォーム
   ============================================ */
.detail-form {
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  padding: 16px;
}

.form-section-collapsible {
  margin-bottom: 12px;
  border: 1px solid #e8eaed;
  border-radius: 6px;
  overflow: hidden;
}

.section-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #f8f9fa;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}

.section-header .section-toggle-btn {
  margin-left: auto;
  border: none;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  width: 20px;
  height: 20px;
}

.section-header .section-icon {
  margin-left: 0;
}

.section-header:hover {
  background: #f1f3f4;
}

.section-icon {
  font-size: 10px;
  color: #5f6368;
  transition: transform 0.2s;
  transform: rotate(180deg);
}

.section-icon.open {
  transform: rotate(0deg);
}

.section-title-text {
  font-size: 13px;
  font-weight: 600;
  color: #202124;
}

.section-badge {
  font-size: 11px;
  color: #d93025;
  font-weight: 500;
  margin-left: 6px;
}

.section-body {
  padding: 14px;
  background: #fff;
}

.form-row-detail {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.form-row-detail-vertical {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.form-group-horizontal {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.form-group-full {
  flex: 1 1 100%;
}

.label-detail {
  font-size: 11px;
  font-weight: 600;
  color: #5f6368;
  min-width: 90px;
  flex-shrink: 0;
}

.input-detail {
  height: 30px;
  padding: 0 8px;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-size: 12px;
  color: #333;
  background: #fff;
  transition: border-color 0.15s;
}

.input-detail:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.08);
}

.input-detail:read-only {
  background: #f8f9fa;
  color: #5f6368;
}

.input-sm {
  width: 80px;
}

.input-md {
  width: 140px;
}

.input-time {
  width: 90px;
}

.input-expand {
  flex: 1;
  min-width: 150px;
}

.input-full {
  flex: 1;
  width: 100%;
}

.time-separator {
  color: #5f6368;
  font-size: 12px;
}

.unit-text {
  font-size: 11px;
  color: #5f6368;
}

.textarea-detail {
  width: 100%;
  padding: 8px;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-size: 12px;
  color: #333;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.15s;
}

.textarea-detail:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.08);
}

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

.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #333;
  cursor: pointer;
  user-select: none;
}

.radio-label input[type="radio"] {
  cursor: pointer;
}

.btn-search-inline {
  padding: 4px 8px;
  background: #f8f9fa;
  border: 1px solid #dadce0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: #5f6368;
  transition: all 0.15s;
}

.btn-search-inline:hover {
  background: #e8eaed;
  color: #1a73e8;
}

.form-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px;
  background: #f8f9fa;
  border-top: 1px solid #e8eaed;
  margin: 16px -16px -16px -16px;
  border-radius: 0 0 8px 8px;
}

.footer-actions-right {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.btn-warning {
  background: #f9ab00;
  color: #fff;
  border-color: #f9ab00;
}

.btn-warning:hover:not(:disabled) {
  background: #ea8600;
}

/* ============================================
   ファイル関連
   ============================================ */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: #f8f9fa;
  border: 1px solid #e8eaed;
  border-radius: 4px;
  font-size: 11px;
}

.file-icon-pdf {
  font-size: 16px;
  color: #d93025;
}

.file-link {
  color: #1a73e8;
  text-decoration: none;
  flex: 1;
}

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

.file-meta {
  font-size: 10px;
  color: #5f6368;
}

.btn-file-delete {
  background: none;
  border: none;
  color: #5f6368;
  font-size: 14px;
  cursor: pointer;
  padding: 2px;
  transition: color 0.15s;
}

.btn-file-delete:hover {
  color: #d93025;
}

/* ============================================
   右カラム: 情報パネル
   ============================================ */
.info-panel {
  background: #e8f0fe;
  border: 1px solid #aecbfa;
  border-radius: 8px;
  overflow: hidden;
}

.info-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #d2e3fc;
  border-bottom: 1px solid #aecbfa;
}

.info-panel-title {
  font-size: 12px;
  font-weight: 600;
  color: #1a73e8;
}

.btn-panel-action {
  background: none;
  border: none;
  color: #5f6368;
  font-size: 14px;
  cursor: pointer;
  padding: 2px;
}

.info-panel-body {
  padding: 10px 12px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(26, 115, 232, 0.1);
  font-size: 11px;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  color: #5f6368;
  font-weight: 500;
}

.info-value {
  color: #202124;
  font-weight: 600;
}

/* ============================================
   タスク管理パネル(コンパクト)
   ============================================ */
.task-panel-compact {
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  overflow: hidden;
}

.task-panel-header {
  padding: 10px 12px;
  background: #f8f9fa;
  border-bottom: 1px solid #e8eaed;
}

.task-panel-title {
  font-size: 12px;
  font-weight: 600;
  color: #202124;
}

.task-count {
  font-size: 10px;
  color: #d93025;
  font-weight: 500;
}

.task-list-compact-container {
  max-height: 250px;
  overflow-y: auto;
}

.task-list-compact {
  padding: 8px;
}

.task-item-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 4px;
  margin-bottom: 4px;
  background: #f8f9fa;
  transition: background 0.15s;
}

.task-item-compact:hover {
  background: #f1f3f4;
}

.task-completed-item {
  opacity: 0.6;
}

.task-check {
  cursor: pointer;
}

.task-check input[type="checkbox"] {
  cursor: pointer;
  width: 14px;
  height: 14px;
}

.task-info {
  flex: 1;
}

.task-name {
  font-size: 11px;
  font-weight: 600;
  color: #202124;
  margin-bottom: 2px;
}

.task-details {
  display: flex;
  gap: 8px;
  font-size: 10px;
  color: #5f6368;
}

.task-assignee {
  flex: 1;
}

.task-amount {
  font-weight: 600;
}

.btn-task-edit {
  background: none;
  border: none;
  color: #5f6368;
  font-size: 13px;
  cursor: pointer;
  padding: 2px;
  transition: color 0.15s;
}

.btn-task-edit:hover {
  color: #1a73e8;
}

/* ============================================
   作業予定者パネル
   ============================================ */
.worker-panel {
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  overflow: hidden;
}

.worker-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #f8f9fa;
  border-bottom: 1px solid #e8eaed;
}

.worker-panel-title {
  font-size: 12px;
  font-weight: 600;
  color: #202124;
}

.btn-panel-add {
  background: #1a73e8;
  border: none;
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.btn-panel-add:hover {
  background: #1557b0;
}

.worker-list-container {
  max-height: 200px;
  overflow-y: auto;
}

.worker-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.worker-table thead {
  background: #f8f9fa;
  position: sticky;
  top: 0;
}

/* KDCS_PRJ-393 (D-5): ここにあった .worker-table th の指定を削除。 components.css で同一セレクタが後から同値で再定義されている（または当該クラスがビューで未使用）ため、削除しても計算値は変わらない。 */

.worker-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #f1f3f4;
}

.btn-mini {
  background: none;
  border: none;
  color: #5f6368;
  font-size: 12px;
  cursor: pointer;
  padding: 2px;
  transition: color 0.15s;
}

.btn-mini:hover {
  color: #1a73e8;
}

/* ============================================
   ファイル一覧パネル
   ============================================ */
.files-panel {
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  overflow: hidden;
}

.files-panel-header {
  padding: 10px 12px;
  background: #f8f9fa;
  border-bottom: 1px solid #e8eaed;
}

.files-panel-title {
  font-size: 12px;
  font-weight: 600;
  color: #202124;
}

.files-list-container {
  max-height: 200px;
  overflow-y: auto;
}

.files-list {
  padding: 8px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
  background: #f8f9fa;
  transition: background 0.15s;
}

.file-row:hover {
  background: #f1f3f4;
}

.file-type-icon {
  font-size: 16px;
}

.file-type-pdf {
  color: #d93025;
}

.file-type-doc {
  color: #1a73e8;
}

.file-type-img {
  color: #34a853;
}

.file-info-compact {
  flex: 1;
}

.file-name-link {
  display: block;
  font-size: 11px;
  color: #1a73e8;
  text-decoration: none;
  margin-bottom: 2px;
}

.file-name-link:hover {
  text-decoration: underline;
}

.file-meta-compact {
  display: flex;
  gap: 8px;
  font-size: 9px;
  color: #5f6368;
}

/* ============================================
   作業予定情報パネル
   ============================================ */
.schedule-info-panel {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: 8px;
  padding: 12px;
}

.schedule-info-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.schedule-info-icon {
  font-size: 16px;
  color: #2e7d32;
}

.schedule-info-title {
  font-size: 12px;
  font-weight: 600;
  color: #2e7d32;
}

.schedule-info-body {
  font-size: 11px;
}

.schedule-info-text {
  margin-bottom: 8px;
  color: #333;
}

.highlight-text {
  color: #d93025;
  font-weight: 600;
}

.checkbox-label-inline {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
  font-size: 11px;
  cursor: pointer;
}

.schedule-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}

.schedule-detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-label {
  font-size: 10px;
  color: #5f6368;
}

.detail-value {
  font-size: 11px;
  color: #202124;
  font-weight: 500;
}

/* ============================================
   コンフリクト警告パネル
   ============================================ */
.conflict-panel {
  background: #fff3e0;
  border: 1px solid #ffb74d;
  border-radius: 8px;
  padding: 12px;
}

.conflict-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.conflict-icon {
  font-size: 16px;
  color: #f57c00;
}

.conflict-title {
  font-size: 12px;
  font-weight: 600;
  color: #e65100;
}

.conflict-body {
  font-size: 11px;
}

.conflict-message {
  color: #333;
  line-height: 1.5;
}

/* ============================================
   詳細画面(案件編集): 2カラム + フッターバー
   ============================================ */

/* main-content-detail: flex列レイアウト(2カラム + フッターバー) */
.main-content-detail {
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* work-detail.html の form を高さ拘束して2カラム内部スクロールを有効化 */
.main-content-detail .detail-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* 2カラムグリッドエリア */
.detail-columns {
  flex: 1;
  min-height: 0; /* flex子要素がコンテンツ高さで膨らむのを防ぐ */
  display: grid;
  grid-template-columns: 1fr 340px;
  overflow: hidden;
  gap: 0;
}

/* 左カラム上書き(detail-columns内) */
.detail-columns .detail-left-column {
  min-height: 0; /* グリッドセルをスクロール可能にする */
  overflow-y: auto;
  padding: 12px 16px 16px;
  background: #fff;
  border-right: 1px solid #e8eaed;
}

/* 右カラム上書き(detail-columns内) */
.detail-columns .detail-right-column {
  min-height: 0; /* グリッドセルをスクロール可能にする */
  overflow-y: auto;
  padding: 10px;
  background: #f4f6f8;
  border-left: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ============================================
   フォーム内テーブル(添付書類・内訳等)
   ============================================ */
.attach-file-table-wrapper,
.inner-table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.attach-file-table,
.inner-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.attach-file-table th,
.attach-file-table td,
.inner-table th,
.inner-table td {
  border: 1px solid #e0e0e0;
  padding: 5px 8px;
  white-space: nowrap;
}

/* KDCS_PRJ-393 (D-5): ここにあった .attach-file-table th / .inner-table th の指定を削除。 components.css で同一セレクタが後から同値で再定義されている（または当該クラスがビューで未使用）ため、削除しても計算値は変わらない。 */

.col-size {
  width: 70px;
  text-align: center;
}

.col-date-sm {
  width: 130px;
  text-align: center;
}

.col-actions-sm {
  width: 50px;
  text-align: center;
}

.col-amount-sm {
  width: 110px;
  text-align: right;
}

.col-workdays {
  width: 90px;
  text-align: center;
}

.col-outsource {
  width: 40px;
  text-align: center;
}

/* ファイルリンクボタン(aタグ代替) */
.file-link-btn {
  background: none;
  border: none;
  color: #1a73e8;
  cursor: pointer;
  font-size: 12px;
  text-decoration: underline;
  padding: 0;
}
.file-link-btn:hover {
  color: #0d47a1;
}

/* Excelファイルアイコン色 */
.file-icon-excel {
  color: #1d6f42;
  margin-right: 4px;
}

/* 消費税メモ */
.tax-note {
  font-size: 11px;
  color: #5f6368;
  white-space: nowrap;
  padding: 0 4px;
}

/* 住所ブロック */
.address-block {
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 12px;
  color: #333;
  width: 100%;
}

.address-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.address-line:last-child {
  margin-bottom: 0;
}

.address-label {
  color: #5f6368;
  font-size: 11px;
  white-space: nowrap;
}

.address-label-ml {
  margin-left: 16px;
}

.address-value {
  color: #333;
  min-width: 80px;
}

/* 必須マーク */
.required-mark {
  color: #d32f2f;
  font-size: 11px;
  margin-left: 2px;
}

/* ============================================
   右パネル: 作業情報1
   ============================================ */
.work-info-panel {
  background: #fff;
  border: 1px solid #aecbfa;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0; /* 右カラムのflex列でパネルが縮まないようにする */
}

.work-info-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #d2e3fc;
  padding: 8px 12px;
}

.work-info-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: #1a56db;
}

.work-info-required-badge {
  font-size: 11px;
  color: #d32f2f;
  font-weight: 600;
}

.work-info-panel-body {
  padding: 0;
}

/* フィールド行 */
.work-info-field-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-bottom: 1px solid #f0f0f0;
  flex-wrap: nowrap;
}

.work-info-field-row:last-child {
  border-bottom: none;
}

.work-info-label {
  font-size: 11px;
  font-weight: 600;
  color: #5f6368;
  min-width: 108px;
  white-space: nowrap;
  flex-shrink: 0;
}

.work-info-input {
  flex: 1;
  height: 26px;
  font-size: 11px;
  border: 1px solid #dadce0;
  border-radius: 3px;
  padding: 0 6px;
  min-width: 0;
  background: #fff;
  color: #333;
}

.work-info-input:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.work-info-input-sm {
  width: 60px;
  height: 26px;
  font-size: 11px;
  border: 1px solid #dadce0;
  border-radius: 3px;
  padding: 0 6px;
  background: #fff;
  color: #333;
  flex-shrink: 0;
}

/* 指定ボタン */
.work-info-specify-btn {
  font-size: 11px;
  padding: 3px 8px;
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.work-info-specify-btn:hover {
  background: #1558b0;
}

/* ============================================
   作業予定一覧(右パネル内)
   ============================================ */
.work-schedule-section {
  padding: 8px 10px;
  border-top: 1px solid #e8eaed;
}

.work-schedule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.work-schedule-title {
  font-size: 12px;
  font-weight: 700;
  color: #333;
}

.work-schedule-table-wrapper {
  overflow-x: auto;
}

.work-schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.work-schedule-table th,
.work-schedule-table td {
  border: 1px solid #e0e0e0;
  padding: 4px 6px;
  white-space: nowrap;
}

/* KDCS_PRJ-393 (D-5): ここにあった .work-schedule-table th の指定を削除。 components.css で同一セレクタが後から同値で再定義されている（または当該クラスがビューで未使用）ため、削除しても計算値は変わらない。 */

.actions-cell {
  display: flex;
  gap: 2px;
  justify-content: center;
}

/* ============================================
   ファイルセクション(右パネル内)
   ============================================ */
.panel-file-section {
  padding: 8px 10px;
  border-top: 1px solid #e8eaed;
}

.panel-file-table-wrapper {
  overflow-x: auto;
}

.panel-file-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.panel-file-table th,
.panel-file-table td {
  border: 1px solid #e0e0e0;
  padding: 4px 6px;
  white-space: nowrap;
}

/* KDCS_PRJ-393 (D-5): ここにあった .panel-file-table th の指定を削除。 components.css で同一セレクタが後から同値で再定義されている（または当該クラスがビューで未使用）ため、削除しても計算値は変わらない。 */

/* ドラッグ&ドロップゾーン */
.file-drop-zone {
  margin-top: 4px;
  border: 2px dashed #f6a623;
  border-radius: 4px;
  padding: 10px;
  text-align: center;
  font-size: 11px;
  color: #f6a623;
  background: #fffbf2;
  cursor: pointer;
}

.file-drop-zone:hover {
  background: #fff3e0;
}

/* ============================================
   + 作業情報を追加する ボタン
   ============================================ */
.add-work-info-link-bar {
  text-align: left;
  padding: 4px 2px;
  flex-shrink: 0; /* 右カラムのflex列でパネルが縮まないようにする */
}

.add-work-info-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: #1a73e8;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
  transition: background 0.15s;
}

.add-work-info-link:hover {
  background: #e8f0fe;
}

.add-icon-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: #1a73e8;
  color: #fff;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  font-weight: 700;
}

/* ============================================
   テクリス・アグリス情報 パネル
   ============================================ */
.tecris-panel {
  background: #fff;
  border: 1px solid #aecbfa;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0; /* 右カラムのflex列でパネルが縮まないようにする */
}

.tecris-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #d2e3fc;
  padding: 8px 12px;
}

.tecris-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: #1a56db;
}

.tecris-panel-body {
  padding: 0;
}

/* テクリス登録テーブル */
.tecris-table-wrapper {
  padding: 6px 10px;
  overflow-x: auto;
}

.tecris-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.tecris-table th,
.tecris-table td {
  border: 1px solid #e0e0e0;
  padding: 4px 6px;
  white-space: nowrap;
}

/* KDCS_PRJ-393 (D-5): ここにあった .tecris-table th の指定を削除。 components.css で同一セレクタが後から同値で再定義されている（または当該クラスがビューで未使用）ため、削除しても計算値は変わらない。 */

/* ============================================
   フッターアクションバー
   ============================================ */
.detail-footer-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #fff;
  border-top: 2px solid #e8eaed;
  flex-shrink: 0;
  z-index: 10;
}

.footer-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.form-select-sm {
  height: 34px;
  font-size: 13px;
  border: 1px solid #dadce0;
  border-radius: 4px;
  padding: 0 8px;
  color: #333;
  background: #fff;
  cursor: pointer;
}

/* テキスト中央揃え(テーブル内) */
.text-center {
  text-align: center;
}

/* ============================================
   S005 微調整(インラインstyle置換)
   ============================================ */
.s005-step-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.s005-step-pill {
  min-width: 86px;
  text-align: center;
  font-size: 11px;
  color: #5f6368;
  background: #e8eaed;
  padding: 3px 10px;
  border-radius: 12px;
}

.s005-step-pill-active {
  color: #fff;
  background: #3c4043;
}

.section-icon-right {
  margin-left: auto;
}

.input-error-red {
  border-color: #e65353;
}

/* ============================================
   S004 発注者区分モーダル(インラインstyle置換)
   ============================================ */
.client-type-modal-content {
  max-width: 880px;
}

.client-type-modal-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}

.client-type-modal-caption {
  font-size: 12px;
  font-weight: 700;
}

.client-type-modal-select {
  min-width: 190px;
}

.client-type-modal-table {
  font-size: 12px;
}

/* ============================================
   S004-1 発注者区分登録・編集
   ============================================ */
.s0041-page {
  margin: 0;
  background: #eef0f3;
  font-family: "Segoe UI", "Yu Gothic UI", sans-serif;
}

.s0041-overlay {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(32, 33, 36, 0.28);
}

.s0041-modal {
  width: 860px;
  max-width: 96vw;
  background: #fff;
  border: 1px solid #d2d6dc;
  border-radius: 6px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.s0041-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 16px;
  font-weight: 700;
  color: #202124;
  background: #f8f9fb;
}

.s0041-close {
  color: #6b7280;
  text-decoration: none;
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}

.s0041-close:hover {
  background: #eceff3;
}

.s0041-body {
  padding: 12px 14px;
}

.s0041-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}

.s0041-caption {
  font-size: 12px;
  font-weight: 700;
  color: #3c4043;
}

.s0041-select-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.s0041-select {
  height: 28px;
  min-width: 170px;
  border: 1px solid #cfd4dc;
  border-radius: 4px;
  font-size: 12px;
  padding: 0 8px;
  background: #fff;
}

.s0041-grid {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #e2e8f0;
  font-size: 12px;
}

/* KDCS_PRJ-393 (D-5): ここにあった .s0041-grid th の指定を削除。 components.css で同一セレクタが後から同値で再定義されている（または当該クラスがビューで未使用）ため、削除しても計算値は変わらない。 */

.s0041-grid td {
  padding: 5px 8px;
  border-bottom: 1px solid #eef2f7;
  color: #374151;
  vertical-align: middle;
}

.s0041-col-wide {
  width: 38%;
}

.s0041-col-narrow {
  width: 12%;
}

.s0041-tree {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.s0041-toggle {
  width: 14px;
  text-align: center;
  color: #6b7280;
  font-weight: 700;
}

.s0041-indent {
  margin-left: 22px;
}

.s0041-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
}

.s0041-icon-btn {
  border: 1px solid #d1d5db;
  border-radius: 3px;
  background: #fff;
  color: #4b5563;
  width: 22px;
  height: 22px;
  line-height: 20px;
  text-align: center;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
}

.s0041-icon-btn:hover {
  background: #f3f4f6;
}

.s0041-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px 12px;
}

.s0041-btn-cancel {
  display: inline-block;
  text-decoration: none;
  border: 1px solid #c6cbd2;
  color: #374151;
  background: #fff;
  border-radius: 4px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
}

.s0041-btn-primary {
  border: none;
  background: #f08a00;
  color: #fff;
  border-radius: 4px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* ============================================
   M002 見積区分マスター
   ============================================ */
.m002-container {
  width: 100%;
  border-radius: 6px;
}

.m002-main {
  padding-top: 12px;
  padding-bottom: 60px;
}

.m002-main .page-header {
  margin-bottom: 10px;
}

.m002-main .page-title {
  font-size: 16px;
  font-weight: 700;
  color: #2c5f9f;
  line-height: 1.2;
}

.m002-table td {
  white-space: normal;
}

/* KDCS_PRJ-393 (D-5): ここにあった .m002-table thead th の指定を削除。 components.css で同一セレクタが後から同値で再定義されている（または当該クラスがビューで未使用）ため、削除しても計算値は変わらない。 */

.m002-table tbody td {
  border-right: none;
}

.m002-col-sort {
  width: 46px;
  text-align: center;
}

.m002-col-name {
  min-width: 300px;
}

.m002-col-default,
.m002-col-action,
.m002-radio-cell,
.m002-action-cell {
  width: 72px;
  text-align: center;
}

.m002-action-cell .btn-action {
  font-size: 35px;
}

.m002-radio-cell {
  vertical-align: middle;
}

.m002-radio-cell input[type="radio"] {
  display: block;
  margin: 0 auto;
  transform: scale(1.2);
  transform-origin: center;
}

.m002-col-default,
.m002-col-action {
  text-align: center !important;
}

.m002-sort-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 100%;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
}

.m002-sort-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-height: 28px;
}

.m002-grip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px 3px;
}

.m002-grip-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #9ca3af;
}

.m002-drag-cell {
  cursor: grab;
  touch-action: none;
}

.m002-drag-cell:active {
  cursor: grabbing;
}

.m002-drag-cell .m002-sort-btn {
  pointer-events: none;
}

.m002-row-dragging {
  opacity: 0.55;
}

.m002-row-over {
  outline: 2px dashed #7aa7dd;
  outline-offset: -2px;
}

.m002-sort-btn:hover {
  color: #1a73e8;
}

.m002-input {
  width: 100%;
  max-width: 480px;
  height: 26px;
  border: 1px solid #e5e7eb;
  border-radius: 3px;
  padding: 0 8px;
  font-size: 12px;
  background: #f8fafc;
  color: #374151;
}

.m002-input:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.12);
}

.m002-table .error-message {
  display: block;
  color: #d93025;
  font-size: 11px;
  margin-top: 2px;
  min-height: 0;
}

.m002-table .error-message:empty {
  display: none;
}

.m002-table-wrapper {
  position: relative;
}

.m002-table-wrapper .empty-message {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
  font-size: 14px;
}

.m002-footer {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 12px 14px;
  border-top: 1px solid #eef1f4;
}

.m002-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: #1a73e8;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.m002-add-btn:hover {
  text-decoration: underline;
}

.m002-save-btn {
  background: #f08a00;
  color: #fff;
  border: 1px solid #f08a00;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
}

.m002-save-btn:hover {
  background: #d97900;
  border-color: #d97900;
}

.m002-bottom-bar {
  width: calc(100% - var(--sidebar-width, 240px));
  padding: 10px 20px;
  background: #b8bdc6;
  display: flex;
  justify-content: flex-end;
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width, 240px);
  right: 0;
  z-index: 100;
}

.sidebar-collapsed .m002-bottom-bar {
  width: 100%;
  left: 0;
}

.m002-mobile-nav {
  display: none;
}

.m002-mobile-nav-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 160px;
  background: #fff;
  border: 1px solid #d7dde5;
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  z-index: 40;
  overflow: hidden;
}

.m002-mobile-nav-item {
  display: block;
  width: 100%;
  border: none;
  background: #fff;
  text-align: left;
  padding: 8px 10px;
  font-size: 12px;
  color: #374151;
  cursor: pointer;
}

.m002-mobile-nav-item:hover {
  background: #f3f6fb;
}

.m002-mobile-user-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 120px;
  background: #fff;
  border: 1px solid #d7dde5;
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  z-index: 45;
  overflow: hidden;
}

.m002-mobile-sidebar-overlay {
  display: none;
}

/* ============================================
   レスポンシブ調整(最低限)
   ============================================ */
@media (max-width: 1200px) {
  .main-content-split {
    grid-template-columns: 1fr;
  }

  .detail-right-column {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 12px;
  }
}

@media (max-width: 768px) {
  /* KDCS_PRJ-166: スマホ表示時は detail-columns を1カラム化し、
     右ペイン固定幅 340px が原因で左ペインが2pxに潰されないようにする。 */
  .detail-columns {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .detail-columns .detail-left-column,
  .detail-columns .detail-right-column {
    width: 100%;
    min-width: 0;
    border-right: none;
    border-left: none;
  }

  .form-row {
    flex-direction: column;
  }

  .form-inline {
    min-width: 100%;
  }

  .form-row-compact {
    flex-direction: column;
  }

  .form-row-detail {
    flex-direction: column;
    align-items: stretch;
  }

  /* M002 mobile layout */
  .m002-page .header-bar {
    display: none;
  }

  .m002-page .layout {
    display: block;
  }

  .m002-page .sidebar {
    display: none !important;
  }

  .m002-page .sidebar.mobile-open {
    display: block !important;
    position: fixed;
    top: 0;
    bottom: 0;
    left: auto !important;
    right: 0 !important;
    z-index: 120;
    width: 250px;
    box-shadow: -8px 0 20px rgba(0, 0, 0, 0.2);
  }

  .m002-page .m002-main {
    padding: 0;
    height: 100dvh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
  }

  .m002-page .m002-mobile-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    position: relative;
    z-index: 70;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0;
    padding: 6px 8px;
  }

  .m002-mobile-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    width: 165px;
    height: 34px;
    border: 1px solid #d8dde5;
    border-radius: 8px;
    background: #eef1f5;
    color: #2f343d;
    padding: 0 0 0 12px;
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
  }

  .m002-mobile-nav-btn > span:first-child {
    flex: 1;
    text-align: center;
  }

  .m002-mobile-nav-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 100%;
    text-align: center;
    font-size: 12px;
    background: #3f6fae;
    color: #fff;
    opacity: 1;
  }

  .m002-mobile-nav-icons {
    display: inline-flex;
    gap: 6px;
    position: relative;
  }

  .m002-page .m002-mobile-sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 110;
  }

  .m002-mobile-icon-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #d5d9e0;
    border-radius: 15px;
    background: #fff;
    color: #5f6368;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
  }

  .m002-mobile-menu-btn {
    border: none;
    background: transparent;
    color: #3f6fae;
    width: 24px;
    height: 32px;
    font-size: 20px;
    border-radius: 0;
  }

  .m002-mobile-user-btn {
    border: none;
    background: #b3c8e6;
    color: #fff;
    border-radius: 50%;
  }

  .m002-user-icon-shape {
    position: relative;
    display: inline-block;
    width: 14px;
    height: 14px;
  }

  .m002-user-icon-shape::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
  }

  .m002-user-icon-shape::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 1px;
    width: 12px;
    height: 7px;
    border-radius: 7px 7px 3px 3px;
    background: #fff;
  }

  .m002-page .m002-main .page-header {
    margin-top: 10px;
    margin-bottom: 10px;
  }

  .m002-page .m002-main .page-title {
    font-size: 15px;
    color: #2c5f9f;
    line-height: 1.2;
    margin-left: 18px;
  }

  .m002-page .m002-container {
    max-width: 100%;
    border-radius: 0;
    overflow-x: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
  }

  .m002-page .m002-table {
    table-layout: fixed;
    width: 100%;
  }

  .m002-page .m002-table thead th,
  .m002-page .m002-table tbody td {
    padding: 8px 6px;
    font-size: 13px;
    white-space: normal;
  }

  .m002-page .m002-col-sort {
    width: 9%;
  }

  .m002-page .m002-col-name {
    min-width: 0;
    width: 55%;
  }

  .m002-page .m002-col-default,
  .m002-page .m002-col-action,
  .m002-page .m002-radio-cell,
  .m002-page .m002-action-cell {
    width: 18%;
  }

  .m002-page .m002-input {
    height: 30px;
    font-size: 13px;
    max-width: 100%;
    width: 100%;
  }

  .m002-page .m002-footer {
    padding: 12px 8px;
    margin-top: 0;
  }

  .m002-page .m002-add-btn {
    font-size: 13px;
  }

  .m002-page .m002-bottom-bar {
    width: 100%;
    max-width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    padding: 10px 10px;
    background: #b8bdc6;
    display: flex;
    justify-content: flex-end;
    border-radius: 0;
    z-index: 100;
  }

  .m002-page .m002-save-btn {
    padding: 8px 14px;
    font-size: 13px;
  }
}

/* ============================================
   SP レスポンシブ（≤767px）
   ============================================ */
@media (max-width: 767px) {
  /* メインコンテンツ: パディング縮小 */
  .main-content {
    padding: 10px 12px;
  }

  /* ページヘッダー: タイトル + アクションを縦積み */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .page-actions {
    flex-wrap: nowrap;
    justify-content: flex-end;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }

  .page-actions::-webkit-scrollbar {
    display: none;
  }

  .page-actions > * {
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* 検索フォーム: パディング縮小 */
  .search-form {
    padding: 10px 12px;
  }

  /* フォーム行: 縦積み */
  .form-row {
    flex-direction: column;
  }

  .form-inline {
    min-width: 100%;
  }

  .form-row-compact {
    flex-direction: column;
  }

  .form-row-detail {
    flex-direction: column;
    align-items: stretch;
  }

  /* グリッドレイアウト: 1カラム化 */
  .main-content-split {
    grid-template-columns: 1fr;
  }

  .detail-right-column {
    grid-template-columns: 1fr;
  }

  /* テーブル: 横スクロールのため最小幅を確保 */
  .data-table {
    min-width: 480px;
  }

  /* lm-table-wrapper: 横スクロール対応 */
  .lm-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* マスター CRUD: 一覧系と同様に横スクロール（480px 最小幅のはみ出し対策） */
  .mastercrud-page .mastercrud-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .mastercrud-page .mastercrud-container {
    overflow-x: visible;
  }

  .mastercrud-page .mastercrud-table.data-table {
    min-width: 0;
    width: 100%;
  }

  /* カード・パネル: パディング縮小 */
  .card-body,
  .panel-body {
    padding: 12px;
  }
}

/* ============================================
   HTMXローディングインジケータ
   ============================================ */
.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator {
  display: inline-block;
}
