/* components.css
   共通コンポーネント(ボタン・カード・バッジ・フォーム部品・ヘッダー・トースト)。
   mockup.html のコンポーネント方針(角丸12-16px, タップ領域44px以上等)を踏襲。 */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 18px;
}

.btn {
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  border-radius: var(--radius-btn);
  padding: 14px 20px;
  min-height: 44px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-lg { min-height: 52px; font-size: 17px; }
.btn-sm { min-height: 36px; padding: 8px 14px; font-size: 14px; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:active:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: var(--on-secondary); }
.btn-ghost { background: transparent; color: var(--secondary); border: 1px solid var(--border); }
html[data-theme="dark"] .btn-ghost { color: var(--text-primary); }
.btn-danger { background: var(--danger-text); color: #FFFFFF; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.badge-pending { background: var(--info-bg); color: var(--info-text); }
.badge-progress { background: color-mix(in srgb, var(--primary) 16%, var(--surface)); color: var(--primary-dark); }
html[data-theme="dark"] .badge-progress { background: color-mix(in srgb, var(--primary) 22%, var(--surface)); color: var(--primary); }
.badge-wait { background: var(--warning-bg); color: var(--warning-text); }
.badge-done { background: var(--success-bg); color: var(--success-text); }
.badge-inactive { background: var(--border); color: var(--text-secondary); }
.badge-danger { background: var(--danger-bg); color: var(--danger-text); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field-label { font-size: 14px; font-weight: 700; color: var(--text-secondary); }
.field-hint { font-size: 12px; color: var(--text-secondary); }
.field input,
.field select,
.field textarea {
  font-family: inherit;
  font-size: 16px;
  padding: 12px 14px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
}
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.field-error { font-size: 13px; color: var(--danger-text); font-weight: 700; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row > .field { flex: 1; min-width: 160px; }

.icon-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.08);
  color: var(--on-secondary);
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  color: var(--on-secondary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  background: var(--text-primary);
  color: var(--bg-page);
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 100;
  box-shadow: 0 8px 20px rgba(0,0,0,.25);
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.toast-error { background: var(--danger-text); color: #fff; }

.empty-state {
  text-align: center;
  color: var(--text-secondary);
  padding: 32px 16px;
  font-size: 14px;
}

.section-label { margin: 0 0 12px; font-size: 15px; font-weight: 700; color: var(--text-secondary); }

/* T-0041: 大規模マスタ対策の検索型セレクタ(ピッカー)。全件<select>スクロール選択を避ける。 */
.picker { position: relative; }
.picker-input-wrap { position: relative; }
.picker-input {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  padding: 12px 40px 12px 14px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  box-sizing: border-box;
}
.picker-input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.picker-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 50%; border: none;
  background: var(--border); color: var(--text-secondary); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px;
}
.picker-dropdown {
  position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-card); max-height: 280px; overflow-y: auto; padding: 4px;
}
.picker-option {
  display: block; width: 100%; text-align: left; background: none; border: none;
  padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 15px;
  font-family: inherit; color: var(--text-primary);
}
.picker-option:hover, .picker-option.active { background: var(--bg-page); }
.picker-option-meta { display: block; font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.picker-empty { padding: 10px 12px; color: var(--text-secondary); font-size: 13px; margin: 0; }

/* T-0041: 重機別内訳・追加商品などの「行追加式」入力の共通レイアウト */
.allocation-row {
  display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px;
  padding: 10px; border: 1px solid var(--border); border-radius: 10px;
}
.allocation-row .picker-field { flex: 1; min-width: 0; }
.allocation-row .allocation-qty { width: 130px; flex-shrink: 0; }
.allocation-sum-hint { font-size: 13px; font-weight: 700; padding: 8px 12px; border-radius: 10px; margin: 6px 0 12px; }
.allocation-sum-hint.ok { background: var(--success-bg); color: var(--success-text); }
.allocation-sum-hint.mismatch { background: var(--warning-bg); color: var(--warning-text); }

table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data-table th, table.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.data-table th { color: var(--text-secondary); font-weight: 700; font-size: 13px; }
table.data-table tr:hover td { background: var(--bg-page); }
