.page {
  min-width: 0;
}

/* 見出しの行（左に見出しと副題・右に編集モードのボタン。`DsAlertsScreen.module.css` と同じ。D-183） */
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  /* エラー一覧・アラートと同じ16px。★直す前もマージンの相殺で16px だった★（.header 4px と .subtitle 16px は足し算にならない。D-181） */
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
}

.subtitle {
  font-size: 13px;
  color: var(--tx-d);
}

/* 見出しの右: 編集モードのボタン（`DsAlertsScreen.module.css` と同じ。D-183） */
.headerRight {
  display: flex;
  align-items: center;
  gap: 8px;
}

/*
 * ★編集モードのボタン★（`ErrorsScreen.module.css` の .editButton 等と同じ。`DsAlertsScreen.module.css` と同じ。D-183）。
 * ★幅は固定★ — 「編集」/ "Edit"・「保存（12件）」/ "Save (12)"・「保存中…」・「キャンセル」/ "Cancel" で
 *   位置が動かないように。
 */
.editButton {
  box-sizing: border-box;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}

.editButton:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.startButton {
  width: 88px;
  border: 1px solid var(--bd);
  background: transparent;
  color: var(--tx);
}

.saveButton {
  width: 120px;
  border: 1px solid transparent;
  background: var(--pr-d);
  color: var(--pr);
}

.cancelButton {
  width: 100px;
  border: 1px solid var(--bd);
  background: transparent;
  color: var(--tx-d);
}

.saveButton:disabled,
.cancelButton:disabled {
  cursor: progress;
}

.statGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

/* ★`<fieldset>` で書いている★（編集中に中の絞り込みをまとめて無効にするため）。既定の枠・余白は消す
   （`DsAlertsScreen.module.css` と同じ。D-183） */
.toolbar {
  margin: 0 0 16px;
  min-width: 0;
  border: 0;
  padding: 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* 分類（ホールディングス / 屋号）のセレクト。モック:835/:838 と同じ見た目。
   ★`font-family` は書かない★（CLAUDE.md §0-3。日本語フォントは globals.css が正） */
.select {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--bd);
  background: var(--sf-h);
  color: var(--tx);
}

/* ホールディングス / 顧客のセレクトは★幅を固定する★（ユーザー指示 2026-10-06。D-162）—
   選んだ名前の長さで幅が変わり、ツールバーの並びがずれるため。切れた名前は title（ホバー）で読む */
.masterSelect {
  width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.searchInput {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--bd);
  background: var(--sf-h);
  color: var(--tx);
  width: 220px;
}

.statusButtons {
  display: flex;
  gap: 6px;
}

/* 編集中（`.toolbar` の fieldset が disabled）は絞り込み全体を薄くする（アラートと同じ。D-181）
   （`DsAlertsScreen.module.css` と同じ。D-183） */
.toolbar:disabled {
  opacity: 0.5;
}

/* ★select だけは薄さを戻す★ — Chromium の UA スタイルが `select:disabled` に opacity 0.7 を付けるため、
   fieldset の 0.5 と掛け算になって 0.35 まで薄くなる（input / textarea / button には UA の opacity は無い。D-181）
   （`DsAlertsScreen.module.css` と同じ。D-183） */
.toolbar:disabled select {
  opacity: 1;
}

/* 編集中は中の部品すべてを押せない見た目にする（`AlertsScreen.module.css` と同じ）。
   ★ページ送りは `button` を足して詳細度を上げる★ — `.pagerFieldset:disabled *` だけだと
   `Pagination.module.css` の `.step:disabled { cursor: default }` と詳細度が同じで、CSS の読み込み順で勝ち負けが変わるため
   （`DsAlertsScreen.module.css` と同じ。D-183） */
.toolbar:disabled *,
.pagerFieldset:disabled button,
.pagerFieldset:disabled * {
  cursor: not-allowed;
}

/* 編集モードの案内（絞り込み・ページ送りが無効な理由）と、保存に失敗した件数（`DsAlertsScreen.module.css` と同じ。D-183） */
.editNotice {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--tx-m);
}

.editNoticeError {
  color: var(--ng);
  font-weight: 600;
}

/* ページ送りを包む `<fieldset>`（編集中に無効にするため）。既定の枠・余白は消す（`DsAlertsScreen.module.css` と同じ。D-183） */
.pagerFieldset {
  margin: 0;
  padding: 0;
  min-width: 0;
  border: 0;
}

.pagerFieldset:disabled {
  opacity: 0.5;
}

.card {
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 12px;
  overflow: hidden;
}

.tableWrap {
  overflow-x: auto;
}

/* 最小幅 800px ＝ 全列の幅の合計（施設名 200px ＋ 固定4列 600px）。★列を広げたら min-width も同じだけ広げること★。
   画面幅1440px 時の親の幅は約1150px（縦スクロールバーが出ると約1139px）なので、横スクロールは出ない。
   ★余った幅（約350px）は全列に幅の比で配られる★（全列に幅があるときの table-layout: fixed の既定の動き。D-167 追記） */
.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
  /* ★列幅を言語によらず固定する★（2026-10-01 ユーザー指摘「言語切り替え時に表などの位置も動く」）。
     既定の auto は見出しの文字で列幅が決まるため、JP/EN を切り替えると列ごとに幅が動く。
     幅は TSX の <colgroup> に付けた .col* で決める */
  table-layout: fixed;
}

/*
 * ---- 列幅（★JP と EN の見出しの広い方を下回らないこと★）----
 * 見出しは 11px・太字・字間0.6px・左右余白 計24px・折り返し禁止（.th / .thCenter）。幅は余白込みの列幅。
 * ★施設名列にも 200px の幅を付け、表の余った幅は全列に幅の比で配る★
 *   （ユーザー指示 2026-10-06「3つとも同じように調整して」。D-167 追記）。
 *   旧: 施設名列だけ幅を付けず余りを全部受け持っていたため、広い画面では施設名列だけが大きく空いていた。
 * ★「接続状態」「最終通信」「備考」は 2026-10-01 時点で lib/i18n.ts に訳語が無く、EN でも日本語のまま★。
 *   訳語を足したら、EN 見出しがこの幅に収まるか見直すこと。
 */

/* 施設名 / FACILITY（D-167 追記）。旧来の最小幅（min-width 800 - 固定4列 600 = 200px）をそのまま列幅にした。
   長い店名は .td の overflow-wrap: anywhere で列の中で折り返す */
.colFacility {
  width: 200px;
}

/* シリアル / SERIAL（見出し 約70px / 約71px）。中身は等幅11px。
   サンプルは「DS-001」と短いが、実機の桁数が未確認なので広めに取り .tdSerial で途中改行させる */
.colSerial {
  width: 140px;
}

/* 接続状態（見出し 約70px）。中身は「正常」「異常」のピル。
   訳語が入っても「CONNECTION」（約105px）程度までは収まる幅にしておく */
.colStatus {
  width: 112px;
}

/* 最終通信（見出し 約70px）。中身は「12/31 02:30」で約100px */
.colLastReported {
  width: 120px;
}

/* 備考（見出し 約47px）。編集モードの入力欄（2行ぶんの固定の大きさ）が入る列（D-183）。
   旧 .tdNote の min-width: 200px（編集で幅が揺れないための最小幅）より広めに取る */
.colNote {
  width: 228px;
}

.th {
  padding: 10px 12px;
  font-size: 11px;
  color: var(--tx-m);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--bd);
  white-space: nowrap;
  font-weight: 600;
  /* ★見出しは中身と同じ左寄せ★（th の既定は中央寄せ。指定が無く、中身（左寄せ）と見出しの位置がずれていた。
     ユーザー指摘 2026-10-06「項目と数値の場所がズレています」。D-168） */
  text-align: left;
}

.thCenter {
  padding: 10px 12px;
  font-size: 11px;
  color: var(--tx-m);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--bd);
  white-space: nowrap;
  font-weight: 600;
  text-align: center;
}

.row {
  border-bottom: 1px solid color-mix(in srgb, var(--bd) 13%, transparent);
}

/* ★編集モードで変えた行の目印（D-165）★ — 背景を薄く色付けし、行の左端に色の帯を出す。
   帯は box-shadow で描く（border を足すと固定幅の列がずれる）（`ErrorsScreen.module.css` と同じ。D-183） */
.rowChanged {
  background: var(--sf-h);
}

.rowChanged > td:first-child {
  box-shadow: inset 3px 0 0 var(--ac);
}

/* 列幅を固定したので、長い英数字（空白の無い文字列）がセルからはみ出さないよう
   どこでも折り返せるようにする（.tdSerial / .td） */
.tdSerial {
  padding: 12px;
  font-size: 11px;
  font-family: var(--font-geist-mono), ui-monospace, monospace;
  color: var(--tx-m);
  overflow-wrap: anywhere;
}

.td {
  padding: 12px;
  font-size: 13px;
  color: var(--tx);
  overflow-wrap: anywhere;
}

.tdCenter {
  padding: 12px;
  text-align: center;
}

.tdDate {
  padding: 12px;
  font-size: 12px;
  color: var(--tx-d);
}

/* ---- 「備考」列（通常モードは文字だけ・編集モードは入力欄。D-183）---- */

.tdNote {
  padding: 12px;
  font-size: 12px;
  color: var(--tx-m);
  /* ★列幅は .colNote（table-layout: fixed）で固定している★。旧来の min-width: 200px は
     固定レイアウトでは効かないため外した。編集モードで入力欄に変わっても列幅は動かない */
}

/* 通常モードの備考（表示だけ。1行・はみ出しは「…」・全文は title）。
   ★文字の頭を見出しの「備考」と揃える★（D-171）— 枠 1px ＋ padding 7px のぶん左右に 8px はみ出させ、
   編集モードの入力欄（.noteInput）と同じ位置から文字を始める。空でも高さを保つ（行の高さが揃う） */
.noteText {
  box-sizing: border-box;
  width: calc(100% + 16px);
  margin: 0 -8px;
  padding: 0 7px;
  border: 1px solid transparent;
  line-height: 1.5;
  min-height: calc(1.5em + 2px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.noteInput {
  display: block;
  /* ★文字の頭を見出しの「備考」と揃える★（D-171）— 枠 1px + padding 7px のぶん左右に 8px はみ出させる
     （通常モードの .noteText と同じ位置から文字を始める） */
  width: calc(100% + 16px);
  margin: 0 -8px;
  box-sizing: border-box;
  font-size: 12px;
  /* globals.css の `font-family: inherit` は button/input/select だけが対象で
     textarea は含まれない。指定しないと日本語がブラウザ既定フォントに落ちる */
  font-family: inherit;
  line-height: 1.5;
  padding: 5px 7px;
  border-radius: 6px;
  border: 1px solid var(--bd);
  background: var(--sf-h);
  color: var(--tx);
  /* ★大きさは固定（D-162 / D-165）★ — 2行ぶんの高さ。長い入力は中でスクロールし、つまみで広げさせない
     （`ErrorsScreen.module.css` と同じ。D-183） */
  height: calc(2 * 1.5em + 12px);
  overflow-y: auto;
  resize: none;
}

.noteInput:focus {
  outline: none;
  border-color: var(--ac);
}

.noteInput:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* 保存に失敗した行（その行の直後の <tr>）（`ErrorsScreen.module.css` と同じ。D-183） */
.rowError {
  padding: 4px 12px 10px;
  font-size: 11px;
  color: var(--ng);
  border-bottom: 1px solid var(--bd);
}

.empty {
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--tx-m);
}

.error {
  padding: 16px 20px;
  font-size: 13px;
  color: var(--ng);
}

.loading {
  padding: 24px 20px;
  font-size: 13px;
  color: var(--tx-m);
  text-align: center;
}
