/* ---- 配色・角丸・影の基準値 ----
   画面ごとに少しずつ違う値を書かずに済むよう、ここでまとめて定義する。
   従来の変数名(--color-blue等)はそのまま残しているため、既存の指定は影響を受けない。 */
:root {
  --color-bg: #ffffff;
  --color-blue: #1a5ca8;
  --color-green: #2e8b57;
  --color-red: #c0392b;
  --color-neutral: #888888;
  --color-border: #dddddd;

  /* 追加分 */
  --color-primary: #1a5ca8;
  --color-primary-dark: #14487f;   /* 押したとき・ホバー時 */
  --color-primary-soft: #eaf1f9;   /* 選択行や見出し帯の薄い青 */
  --color-text: #1f2933;           /* 真っ黒より少し柔らかい文字色 */
  --color-text-muted: #6b7684;     /* 補足文。従来の#888より濃くして読みやすくする */
  --color-surface: #ffffff;
  --color-surface-muted: #f7f9fb;  /* 薄いグレーの面 */
  --color-border-light: #e6eaee;
  --color-focus: #4a90d9;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-xs: 0 1px 2px rgba(16, 32, 56, 0.06);
  --shadow-sm: 0 1px 3px rgba(16, 32, 56, 0.08), 0 1px 2px rgba(16, 32, 56, 0.04);
  --shadow-md: 0 4px 12px rgba(16, 32, 56, 0.10);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-surface-muted);
  color: var(--color-text);
  font-family: -apple-system, "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  font-size: clamp(14px, 1.6vw, 17px);
  line-height: 1.75;
  -webkit-text-size-adjust: 100%;
}

h1 { font-size: 1.35em; letter-spacing: 0.01em; margin: 0 0 14px; }
h2 { font-size: 1.1em; letter-spacing: 0.01em; }

/* キーボード操作時にどこを触っているか分かるようにする(アクセシビリティ) */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

button { font-family: inherit; cursor: pointer; transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s; }
button:disabled { cursor: not-allowed; }


/* 画面本体は白い面として、背景のグレーから浮かせる */
.screen { display: none; padding: 16px 16px calc(16px + var(--safe-bottom)); }
.screen.is-active { display: block; }

main > .screen.is-active {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin: 16px auto;
  max-width: 1280px;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-xs);
  position: sticky;
  top: 0;
  z-index: 10;
}
/* ロゴ側とユーザー側に同じ幅(1:1)を割り当てることで、右側のログアウト等が隠れている状態でも
   ナビゲーションが常に中央に来るようにする(justify-content: space-betweenだと、右側が
   非表示のときにナビゲーションが右端へ寄ってしまうため)。 */
.app-header-logo {
  flex: 1 1 0;
  min-width: 0;
  font-weight: bold;
  color: var(--color-blue);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header-nav { flex: 0 1 auto; display: flex; gap: 12px; overflow-x: auto; justify-content: center; }
.nav-item {
  color: var(--color-neutral);
  white-space: nowrap;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 4px 2px;
  font-size: 1em;
  font-family: inherit;
  cursor: pointer;
}
.nav-item.is-active { color: var(--color-blue); font-weight: bold; border-bottom: 2px solid var(--color-blue); }
.nav-item.is-disabled, .nav-item:disabled { color: #ccc; cursor: default; }
.app-header-user {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-size: 0.85em;
  white-space: nowrap;
  /* アカウントのメニューがヘッダーの下へはみ出して開くため、ここでは切り取らない */
  overflow: visible;
}

/* ログイン前(ログイン画面・2段階認証の入力画面)は、ヘッダーのナビゲーションとログアウトを隠す。
   「今どの画面が表示されているか」だけで判定しているため、JavaScript側の状態と食い違って
   「ログイン後もログアウトが出てこない」といった事故が起きない。
   body.is-signed-outはapp.jsのshowScreen()が付け外しするもので、:has()に対応していない
   古いブラウザ向けの保険として併記している。 */
body.is-signed-out .app-header-nav,
body.is-signed-out .app-header-user,
body:has(#screen-login.is-active) .app-header-nav,
body:has(#screen-login.is-active) .app-header-user,
body:has(#screen-mfa-challenge.is-active) .app-header-nav,
body:has(#screen-mfa-challenge.is-active) .app-header-user {
  display: none;
}

/* ---- ログイン ---- */
.login-form {
  max-width: 360px;
  margin: 40px auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9em; }
.login-form input {
  padding: 10px;
  font-size: 16px; /* iOS Safariでズームさせないため16px以上 */
  border: 1px solid var(--color-border);
  border-radius: 4px;
}
.login-form button {
  padding: 12px;
  background: var(--color-blue);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1em;
}
.form-error { color: var(--color-red); min-height: 1.2em; font-size: 0.85em; }
.login-note { font-size: 0.75em; color: var(--color-neutral); }

/* ---- フォーム部品の共通スタイル ----
   selectにスタイルを何も指定していない場所(ホーム画面の対象サイクル等)は、OS標準の枠なし表示に
   なってしまい、地の文と見分けがつかず選択できることに気づきにくい。全てのselectに共通の枠・背景を
   与えて、どの画面でも「選べる箱」だと分かるようにする。 */
select {
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 16px; /* iOS Safariでズームさせないため16px以上 */
  font-family: inherit;
  color: #000;
  background: #fff;
}

/* ラベル文字を小さく上段に、選択ボックスを下段に積む共通レイアウト(対象サイクル等)。 */
.select-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85em;
  color: var(--color-neutral);
}
.select-label select { font-size: 1em; }

/* ---- ホーム画面 ---- */
/* 期とサイクルを1つにまとめた選択肢は文字数が多いため、幅を広めに取る */
.cycle-select-wide { min-width: 340px; }

.home-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.home-progress { font-weight: bold; }

table.home-table, table.sheet-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
table.home-table th, table.home-table td,
table.sheet-table th, table.sheet-table td {
  border: 1px solid var(--color-border);
  padding: 8px 6px;
  text-align: center;
  word-break: break-word;
}
table.home-table thead, table.sheet-table thead {
  background: #f2f6fa;
}
.home-row { cursor: pointer; }
.home-row:active { background: #eef4fb; }

.status-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.85em;
}
.status-badge.status-todo { background: #eeeeee; color: #666; }
.status-badge.status-doing { background: #fff3cd; color: #8a6d00; }
.status-badge.status-done { background: #e3f5e8; color: var(--color-green); }

/* ---- 点検実施画面(旧システムの列順を維持) ---- */
table.sheet-table { font-size: 0.95em; }
table.sheet-table th, table.sheet-table td { padding: 6px; }
.col-no { width: 6%; }
/* 本番点検チェックシート画面での項目入れ替え(管理者のみ表示)。 */
.reorder-buttons { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
/* チェックシート作成画面の点検場所の並び替え。点検実施画面の項目並び替えと同じ見た目にする。
   「順」の列が広いため、そのままだとボタンが列幅いっぱいに伸びてしまう。中央に寄せて幅を固定する。 */
table.master-table .reorder-buttons { align-items: center; }
.sheet-reorder-btn {
  width: 40px;
  flex: none;
  min-height: 18px;
  padding: 0;
  line-height: 1;
  font-size: 0.75em;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  background: #fff;
}
.sheet-reorder-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.reorder-btn {
  min-width: 22px;
  min-height: 18px;
  padding: 0;
  line-height: 1;
  font-size: 0.75em;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  background: #fff;
}
.reorder-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.col-category { width: 10%; }
.col-content { width: 30%; text-align: left; }
.col-points { width: 8%; }
.col-role { width: 10%; }
.col-eval { width: 16%; }
.col-score { width: 8%; }
.col-photo { width: 8%; }

/* 点検役割ごとの背景色は行全体へ薄く適用する(点検役割マスタのcolorをチェックシート
   生成時にスナップショットしたroleColorを、行のインラインstyleで薄めて反映する)。 */
.sheet-row { background: transparent; }
.sheet-total-row { font-weight: bold; background: #f2f6fa; }
.sheet-print-header { display: none; }

/* 評価ボタン(参考アプリに合わせた表示)。
   未評価時は候補(○×やABC)を並べて常時色付きで表示し、いずれかを選択したら
   選択されたボタンだけを残して拡大表示する(他方はJS側でis-hiddenを付けて隠す)。
   選択の取り消しは、選択中のボタンをもう一度押すことで未評価の状態に戻す(checksheet.js側)。 */
/* .col-eval自体はtable-cellのまま(tdにdisplay:flexを直接指定すると、テーブル内部表示
   (table-cell)がブロック化されて列幅の計算から外れてしまい、ボタンが小さく崩れる)。
   ボタンを並べるflexコンテナは内側のdiv(.eval-buttons)側に持たせる。 */
.col-eval { padding: 4px; }
.eval-buttons {
  display: flex;
  gap: 4px;
  align-items: stretch;
  justify-content: center;
  height: 100%;
}
.eval-btn {
  flex: 1;
  min-width: 40px;
  min-height: 48px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  font-weight: bold;
  font-size: 1.3em;
  color: #fff;
}
.eval-btn[data-value="○"],
.eval-btn[data-value="A"] { background: var(--color-blue); }
.eval-btn[data-value="×"] { background: var(--color-red); }
.eval-btn[data-value="B"] { background: #e0a300; }
.eval-btn[data-value="C"] { background: var(--color-neutral); }
.eval-btn.is-hidden { display: none; }
.eval-btn.is-active {
  min-height: 56px;
  font-size: 1.8em;
}
.eval-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ABC評価は候補が3つになる分、○×と同じ大きさだとセルの枠からはみ出してしまうため、
   一回り小さいサイズにして3つとも枠内に収まるようにする。 */
.eval-buttons-abc .eval-btn {
  min-width: 26px;
  font-size: 1em;
}
.eval-buttons-abc .eval-btn.is-active {
  min-height: 48px;
  font-size: 1.4em;
}

.photo-btn {
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: #fff;
  font-size: 1em;
}
.photo-btn-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.note-btn {
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: #fff;
  font-size: 1em;
}

.sheet-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--color-bg);
  border-top: 2px solid var(--color-border);
  padding: 8px 4px calc(8px + var(--safe-bottom));
  margin-top: 8px;
}
.sheet-footer button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--color-blue);
  color: var(--color-blue);
  background: #fff;
  border-radius: 4px;
}
.online-badge { font-size: 0.85em; padding: 2px 8px; border-radius: 4px; }
.online-badge.is-online { background: #e3f5e8; color: var(--color-green); }
.online-badge.is-offline { background: #fdecea; color: var(--color-red); }

/* 横スクロールは必要最小限。画面内に収まらない場合のみ許容する */
@media (max-width: 400px) {
  table.sheet-table { display: block; overflow-x: auto; }
}

/* ---- 2段階認証(MFA)画面 ---- */
.is-hidden { display: none !important; }

.mfa-panel {
  max-width: 360px;
  margin: 40px auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mfa-panel label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9em; }
.mfa-panel input {
  padding: 10px;
  font-size: 16px; /* iOS Safariでズームさせないため16px以上 */
  border: 1px solid var(--color-border);
  border-radius: 4px;
  letter-spacing: 0.2em;
}
.mfa-panel button {
  padding: 12px;
  background: var(--color-blue);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1em;
}
#mfa-enroll-step1 { display: flex; flex-direction: column; gap: 8px; }
#mfa-qr-canvas { align-self: center; }
.mfa-secret-label { font-size: 0.8em; color: var(--color-neutral); margin-bottom: 0; }
.mfa-secret-text {
  font-family: monospace;
  font-size: 1.1em;
  letter-spacing: 0.15em;
  text-align: center;
  padding: 8px;
  background: #f2f6fa;
  border-radius: 4px;
  word-break: break-all;
}

/* ---- 各種設定・ユーザー管理画面 ---- */
.settings-note { font-size: 0.85em; color: var(--color-neutral); }
.settings-subheading { margin-top: 24px; font-size: 1.05em; }
.settings-status { min-height: 1.2em; font-size: 0.85em; color: var(--color-green); }
.settings-warning {
  background: #fdecea;
  color: var(--color-red);
  padding: 8px;
  border-radius: 4px;
  font-size: 0.85em;
}
.settings-warning ul { margin: 6px 0 0; padding-left: 20px; }

.settings-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 12px;
}
.settings-tab {
  white-space: nowrap;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--color-neutral);
  font-size: 0.95em;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.settings-tab.is-active { color: var(--color-blue); font-weight: bold; border-bottom-color: var(--color-blue); }

.settings-panel { display: none; }
.settings-panel.is-active { display: block; }

table.master-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}
table.master-table th, table.master-table td {
  border: 1px solid var(--color-border);
  padding: 6px;
  text-align: center;
  font-size: 0.9em;
}
table.master-table thead { background: #f2f6fa; }
table.master-table input[type="text"],
table.master-table input[type="number"] {
  width: 100%;
  min-width: 60px;
  padding: 6px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 0.95em;
}
table.master-table .cell-input-narrow { width: 4em; min-width: 4em; }
table.master-table .row-save {
  padding: 6px 10px;
  border: 1px solid var(--color-blue);
  color: var(--color-blue);
  background: #fff;
  border-radius: 4px;
}

.master-add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 20px;
}
.master-add-form input, .master-add-form select {
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 0.95em;
}
.master-add-form button {
  padding: 8px 14px;
  background: var(--color-blue);
  color: #fff;
  border: none;
  border-radius: 4px;
}
.master-add-form-wide { align-items: flex-start; }

/* ---- 共通項目の適用先(事業所)選択 ---- */
.applies-cell { min-width: 140px; text-align: left; }
.applies-summary { font-size: 0.88em; margin-bottom: 4px; word-break: break-all; }
.applies-toggle-btn {
  padding: 4px 8px;
  border: 1px solid var(--color-neutral);
  color: var(--color-neutral);
  background: #fff;
  border-radius: 4px;
  font-size: 0.85em;
}
.applies-editor { margin-top: 6px; text-align: left; }
.applies-editor.is-hidden { display: none; }
.applies-editor label { display: block; font-size: 0.88em; font-weight: normal; margin-bottom: 4px; }
.applies-location-checks {
  max-height: 120px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 4px 6px;
  margin-top: 4px;
}
.applies-location-checks.is-hidden { display: none; }
.applies-location-option { display: block; font-size: 0.85em; font-weight: normal; margin: 2px 0; }
.commonItems-filter-bar { margin-bottom: 10px; display: flex; align-items: center; gap: 8px; font-size: 0.9em; }

.mail-recipients-textarea {
  width: 100%;
  max-width: 420px;
  display: block;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 0.95em;
  margin-bottom: 8px;
}

.pattern-card {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 16px;
}
.pattern-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.pattern-name-input {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 1em;
}
.pattern-add-location {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.pattern-add-location select {
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
}
.pattern-add-location button {
  padding: 8px 12px;
  border: 1px solid var(--color-blue);
  color: var(--color-blue);
  background: #fff;
  border-radius: 4px;
}

/* ---- チェックシート作成画面 ---- */
#home-create-cycle-btn,
#home-manage-cycle-btn,
#cycle-create-back,
#cycle-item-edit-back {
  padding: 8px 14px;
  border: 1px solid var(--color-blue);
  color: var(--color-blue);
  background: #fff;
  border-radius: 4px;
  margin-bottom: 12px;
}
#cycle-confirm-wrap { display: flex; gap: 8px; margin-top: 8px; }
#cycle-confirm-button, #cycle-unlock-button {
  padding: 10px 16px;
  border: none;
  border-radius: 4px;
  background: var(--color-blue);
  color: #fff;
}
#cycle-unlock-button { background: var(--color-red); }
table.master-table .cycle-item-remove {
  padding: 6px 10px;
  border: 1px solid var(--color-red);
  color: var(--color-red);
  background: #fff;
  border-radius: 4px;
  margin-left: 4px;
}

/* ---- 社長の宿題(ホーム画面) ---- */
.homework-box {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.homework-column { flex: 1; min-width: 240px; }
.homework-label { font-size: 0.85em; color: var(--color-neutral); margin: 0 0 6px; }
.homework-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.homework-list-readonly li {
  padding: 6px 8px;
  background: #fdf3e0;
  border-radius: 4px;
  font-size: 0.9em;
}
.homework-item { display: flex; gap: 6px; align-items: center; }
.homework-item input[type="text"] {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 0.95em;
}
.homework-item button {
  padding: 6px 10px;
  border: 1px solid var(--color-blue);
  color: var(--color-blue);
  background: #fff;
  border-radius: 4px;
  white-space: nowrap;
}
.homework-item .homework-open-improvement {
  border-color: var(--color-neutral);
  color: var(--color-neutral);
}
.homework-camera-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--color-neutral);
  color: var(--color-neutral);
  background: #fff;
  border-radius: 4px;
  font-size: 1.1em;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.homework-add-button {
  padding: 8px 12px;
  border: 1px dashed var(--color-blue);
  color: var(--color-blue);
  background: #fff;
  border-radius: 4px;
}

/* ---- サイン・点検完了(点検実施画面に統合) ---- */
#sheet-reopen-button,
#sheet-reset-button { border-color: var(--color-red); color: var(--color-red); }
.sign-conditions-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sign-conditions-list li {
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 0.9em;
}
.sign-conditions-list li.is-ok { background: #e3f5e8; color: var(--color-green); }
.sign-conditions-list li.is-ng { background: #fdecea; color: var(--color-red); }
.sign-canvas-wrap {
  border: 1px solid var(--color-border);
  border-radius: 4px;
  display: inline-block;
  touch-action: none;
  margin-top: 8px;
}
#sign-canvas { display: block; max-width: 100%; touch-action: none; background: #fff; }
.sign-canvas-controls { margin: 8px 0; }
#sign-clear-button, #sign-submit-button {
  padding: 10px 16px;
  border: 1px solid var(--color-blue);
  color: var(--color-blue);
  background: #fff;
  border-radius: 4px;
}
/* クリア(書き直し)は注意色、保存して完了する操作は完了を表す緑で分かりやすくする */
#sign-clear-button { border-color: var(--color-red); color: var(--color-red); }
#sign-submit-button { background: var(--color-green); border-color: var(--color-green); color: #fff; margin-top: 4px; font-weight: bold; }
#sign-completed-wrap p { margin: 0 0 8px; font-size: 0.95em; }
.sign-completed-image {
  display: block;
  max-width: 300px;
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: #fff;
}

/* ---- 改善一覧・点検結果改善確認 ---- */
.improvement-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; }
.improvement-row { cursor: pointer; }
.improvement-row:active { background: #eef4fb; }

/* ---- 改善登録・参照画面(improvement.html) ---- */
.improvement-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px calc(16px + var(--safe-bottom));
  font-family: -apple-system, "Hiragino Sans", "Yu Gothic", sans-serif;
}
.improvement-page label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9em; margin-bottom: 12px; }
.improvement-page input[type="text"],
.improvement-page input[type="date"],
.improvement-page textarea {
  padding: 10px;
  font-size: 16px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-family: inherit;
}
.improvement-readonly-field {
  padding: 8px 10px;
  background: #f2f6fa;
  border-radius: 4px;
  font-size: 0.95em;
}
.improvement-photo-section { margin-bottom: 16px; }
.improvement-photo-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.improvement-photo-thumb { position: relative; width: 96px; height: 96px; }
.improvement-photo-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; border: 1px solid var(--color-border); }
.improvement-photo-thumb button {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--color-red);
  color: #fff;
  font-size: 0.75em;
  line-height: 1;
}
.improvement-photo-buttons { display: flex; gap: 8px; }
.improvement-photo-buttons button, .improvement-photo-buttons label {
  padding: 10px 14px;
  border: 1px solid var(--color-blue);
  color: var(--color-blue);
  background: #fff;
  border-radius: 4px;
  font-size: 0.9em;
  cursor: pointer;
}
.improvement-detail-toggle {
  padding: 8px 0;
  background: none;
  border: none;
  color: var(--color-blue);
  font-size: 0.9em;
  cursor: pointer;
}
.improvement-detail-fields { display: none; flex-direction: column; gap: 12px; }
.improvement-detail-fields.is-open { display: flex; }
.improvement-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.improvement-actions button {
  padding: 10px 16px;
  border: 1px solid var(--color-blue);
  color: var(--color-blue);
  background: #fff;
  border-radius: 4px;
}
.improvement-actions .improvement-primary { background: var(--color-blue); color: #fff; }
.improvement-actions .improvement-danger { border-color: var(--color-red); color: var(--color-red); }
.improvement-status { min-height: 1.2em; font-size: 0.85em; color: var(--color-green); margin-top: 8px; }
.improvement-cancelled-banner {
  background: #fdecea;
  color: var(--color-red);
  padding: 8px;
  border-radius: 4px;
  margin-bottom: 12px;
  font-size: 0.9em;
}

/* =========================================================================
   全体の見た目の調整
   ここまでの定義は画面ごとに個別に書かれているため、共通部分(入力欄・ボタン・表・
   補足文など)の見た目をここで整える。印刷用の指定より前に置くこと(印刷側の指定が
   後に来ることで、印刷時はそちらが優先される)。
   ========================================================================= */

/* ---- ログイン・2段階認証は、中央の1枚のカードとして見せる ---- */
main > #screen-login.is-active,
main > #screen-mfa-challenge.is-active,
main > #screen-mfa-enroll.is-active {
  background: none;
  border: none;
  box-shadow: none;
}
.login-form,
.mfa-panel {
  max-width: 380px;
  margin: 48px auto;
  padding: 28px 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  gap: 14px;
}
.login-form h1,
#screen-login h1 { text-align: center; }

/* ---- ヘッダーのナビゲーション ---- */
.app-header-logo { letter-spacing: 0.04em; }
.app-header-nav { gap: 4px; }
.nav-item {
  padding: 6px 12px;
  border-bottom: none;
  border-radius: var(--radius-sm);
  font-size: 0.95em;
}
.nav-item:hover { background: var(--color-surface-muted); color: var(--color-text); }
.nav-item.is-active {
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
  border-bottom: none;
}
.app-header-user { color: var(--color-text-muted); }
/* ---- ヘッダー右上: お知らせ(ベル)とアカウントのメニュー ---- */
.header-icon-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--color-text-muted);
}
.header-icon-button:hover { background: var(--color-primary-soft); color: var(--color-primary); }
/* 未読の件数 */
.header-badge {
  position: absolute;
  top: 3px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #e5484d;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-sizing: border-box;
  pointer-events: none;
}
/* マウスを乗せたときの吹き出し(「お知らせ」) */
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: 4px;
  background: #222;
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1100;
}

.user-menu { position: relative; }
.user-menu-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 40px;
  padding: 0 6px 0 4px;
  border: none;
  border-radius: 20px;
  background: none;
  color: var(--color-text-muted);
}
.user-menu-button:hover,
.user-menu-button[aria-expanded="true"] { background: var(--color-primary-soft); }
.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #4a9fe0;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}
.user-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 1200;
  min-width: 200px;
  padding: 6px;
  border: 1px solid var(--color-border-light);
  border-radius: 10px;
  background: var(--color-surface, #fff);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
  /* 画面の幅で文字の大きさが変わらないよう固定する */
  font-size: 14px;
}
.user-menu-panel.is-hidden { display: none; }
.user-menu-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--color-border-light);
  margin-bottom: 4px;
}
.user-menu-name {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text);
  font-size: 1.05em;
  font-weight: 700;
}
.user-menu-role { color: var(--color-text-muted); font-size: 0.9em; }
#logout-button {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--color-text);
  font-size: 1em;
  text-align: left;
}
#logout-button:hover { background: var(--color-primary-soft); color: var(--color-primary); }

/* ---- 入力欄の共通スタイル ----
   表の中の入力欄(table.master-table input)は、より詳しい指定が先にあるため影響を受けない。 */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select {
  padding: 9px 11px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
  font-size: 16px; /* iOS Safariでズームさせないため16px以上 */
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26, 92, 168, 0.15);
}
input::placeholder, textarea::placeholder { color: #9aa4b0; }

/* ファイル選択ボタン(CSV取込など)も、他のボタンと揃った見た目にする */
input[type="file"] { font-size: 0.85em; color: var(--color-text-muted); }
input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 8px 12px;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-primary);
  font-family: inherit;
  font-size: 1em;
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: var(--color-primary-soft); }

/* ---- ボタン ---- */
/* 主要な操作(塗りつぶし) */
.login-form button,
.mfa-panel button,
.master-add-form button,
#cycle-confirm-button,
.improvement-actions .improvement-primary {
  min-height: 42px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}
.login-form button:hover,
.mfa-panel button:hover,
.master-add-form button:hover,
#cycle-confirm-button:hover,
.improvement-actions .improvement-primary:hover {
  background: var(--color-primary-dark);
}
/* 補助的な操作(枠線) */
.sheet-footer button,
table.master-table .row-save,
#home-create-cycle-btn,
#home-manage-cycle-btn,
#cycle-create-back,
#cycle-item-edit-back,
#cycle-item-renumber-button,
.pattern-add-location button,
.homework-item button,
.improvement-actions button,
.improvement-photo-buttons button,
.improvement-photo-buttons label,
#mail-recipients-save,
#mail-test-send,
#commonItems-csv-export,
#commonItems-csv-import,
#patterns-add-button,
.yearly-actions button {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-primary);
  font-size: 0.95em;
}
.sheet-footer button:hover,
table.master-table .row-save:hover,
#home-create-cycle-btn:hover,
#home-manage-cycle-btn:hover,
#cycle-create-back:hover,
#cycle-item-edit-back:hover,
#cycle-item-renumber-button:hover,
.pattern-add-location button:hover,
.homework-item button:hover,
.improvement-actions button:hover,
#mail-recipients-save:hover,
#mail-test-send:hover,
#commonItems-csv-export:hover,
#commonItems-csv-import:hover,
#patterns-add-button:hover,
.yearly-actions button:hover {
  background: var(--color-primary-soft);
}
/* 保存は最もよく押すボタンなので、塗りつぶしにして見つけやすくする */
#mail-recipients-save,
#commonItems-csv-export,
#yearly-cycle-save {
  background: var(--color-primary);
  color: #fff;
}
#mail-recipients-save:hover,
#commonItems-csv-export:hover,
#yearly-cycle-save:hover {
  background: var(--color-primary-dark);
  color: #fff;
}

/* ---- 補足文・状態表示 ---- */
.settings-note {
  color: var(--color-text-muted);
  font-size: 0.82em;
  line-height: 1.7;
  background: var(--color-surface-muted);
  border-left: 3px solid var(--color-border-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 8px 12px;
  margin: 10px 0;
  /* 1行が長くなりすぎると読みにくいため、行の長さを抑える */
  max-width: 72em;
}
/* 中身が空のときに、灰色の帯だけが残らないようにする */
.settings-note:empty { display: none; }
/* 行の中に差し込む短い注記は、囲みにせず地の文のままにする */
.settings-note.commonItems-csv-inline-note {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
}
/* 状態表示は、成功と失敗で色を分ける(既定は目立たない灰色)。
   以前は常に緑で表示していたため、失敗のときも成功したように見えてしまっていた。 */
.settings-status,
.improvement-status {
  color: var(--color-text-muted);
  font-size: 0.85em;
  min-height: 1.2em;
}
.settings-status.is-success,
.improvement-status.is-success { color: var(--color-green); font-weight: 600; }
.settings-status.is-error,
.improvement-status.is-error { color: var(--color-red); font-weight: 600; }

.settings-warning {
  background: #fdf2f0;
  border: 1px solid #f3cfc9;
  border-left: 4px solid var(--color-red);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  line-height: 1.7;
}

.settings-subheading {
  margin-top: 28px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border-light);
  font-size: 1.05em;
  font-weight: 600;
  color: var(--color-text);
}

/* ---- タブ ---- */
.settings-tabs {
  gap: 2px;
  border-bottom: 1px solid var(--color-border-light);
  margin-bottom: 16px;
}
.settings-tab {
  padding: 10px 16px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: 0.95em;
  border-bottom: 3px solid transparent;
  color: var(--color-text-muted);
}
.settings-tab:hover { background: var(--color-surface-muted); color: var(--color-text); }
.settings-tab.is-active {
  background: var(--color-primary-soft);
  border-bottom-color: var(--color-primary);
  color: var(--color-primary-dark);
}

/* ---- 表 ---- */
table.master-table,
table.home-table,
table.sheet-table {
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}
table.master-table th,
table.master-table td,
table.home-table th,
table.home-table td,
table.sheet-table th,
table.sheet-table td {
  border-color: var(--color-border-light);
}
table.master-table thead,
table.home-table thead,
table.sheet-table thead {
  background: var(--color-primary-soft);
}
table.master-table thead th,
table.home-table thead th,
table.sheet-table thead th {
  color: var(--color-primary-dark);
  font-weight: 600;
  font-size: 0.9em;
  letter-spacing: 0.02em;
}
table.master-table tbody tr:nth-child(even),
table.home-table tbody tr:nth-child(even) { background: #fbfcfd; }
table.master-table tbody tr:hover,
table.home-table tbody tr:hover { background: var(--color-primary-soft); }
table.master-table th, table.master-table td { padding: 8px 7px; }

/* 見出しや短い語が縦に折り返されて読みにくくなるのを防ぐ
   (「評価方式」が2行になる、「保存」が1文字ずつ折り返される、といった状態への対処) */
table.master-table th { white-space: nowrap; }
table.master-table td button { white-space: nowrap; }
table.master-table input[type="text"],
table.master-table input[type="number"] { min-width: 48px; }

/* ---- まとまりのある箱(点検パターン・社長の宿題・CSV操作など) ---- */
.pattern-card,
.homework-box {
  border-color: var(--color-border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  background: var(--color-surface);
}
/* 社長の宿題の見出しは、横並びの列の1つとして潰れないよう、箱の上段に幅いっぱいで置く */
.homework-box .settings-subheading {
  flex: 1 0 100%;
  margin-top: 0;
  margin-bottom: 4px;
  border-bottom: none;
  padding-bottom: 0;
}
.commonItems-filter-bar,
#commonItems-csv-bar,
#mail-test-wrap {
  flex-wrap: wrap;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 14px;
}
#mail-test-wrap { display: block; }
#mail-test-wrap .settings-note { background: none; border: none; padding: 0; margin: 6px 0 10px; }
.homework-list-readonly li { background: #fdf6e8; border: 1px solid #f0e2c4; }

/* 新規追加のフォームは、一覧との境目が分かるよう1つの面としてまとめる */
.master-add-form {
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  gap: 10px;
}

/* チェックボックスは小さくて押しにくいので、少し大きくしてブランド色に合わせる */
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
}
.applies-location-option input[type="checkbox"] { width: 16px; height: 16px; }

/* 改善登録は別タブで開く独立したページなので、こちらも1枚のカードとして見せる */
.improvement-page {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin: 16px auto;
  padding: 24px;
}
.improvement-page h1 { margin-bottom: 16px; }
.improvement-photo-section {
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 14px;
}

.status-badge { font-weight: 600; border-radius: 999px; padding: 3px 10px; }
.online-badge { font-weight: 600; border-radius: 999px; }

.sheet-footer {
  border-top: 1px solid var(--color-border-light);
  box-shadow: 0 -2px 8px rgba(16, 32, 56, 0.06);
  gap: 8px;
  flex-wrap: wrap;
}

/* ---- 表を横に収めきれない狭い画面では、表だけ横スクロールさせる ---- */
@media (max-width: 640px) {
  main > .screen.is-active { margin: 8px; border-radius: var(--radius-md); }
  .screen { padding: 12px 12px calc(12px + var(--safe-bottom)); }
  table.master-table { display: block; overflow-x: auto; }
}

/* ---- 印刷(点検実施画面)。画面上の操作用パーツを消し、見本のような報告書らしい見た目にする ----
   項目数が多いサイクルでも極力ページ数を抑えられるよう、文字サイズ・余白を全体的に詰めている。
   ただし項目数によっては複数ページにまたがることがあり、それ自体は正常な動作(用紙1枚に
   収まりきらない量の項目がある場合、無理に1枚へ収めると文字が判読できなくなるため)。 */
/* ---- 年間集計(旧システムの年間集計表に体裁を合わせている) ----
   サイクルぶん列が増えるため、表だけ横スクロールさせる(画面全体が横に伸びると
   iPadでヘッダーまでずれて操作しにくくなるため)。 */
.yearly-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
}
.yearly-report-title {
  margin: 20px 0 10px;
  font-size: 1.15em;
  font-weight: 700;
}
.yearly-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}
table.yearly-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 0.9em;
}
table.yearly-table th,
table.yearly-table td {
  border: 1px solid #9fc4d6;
  padding: 6px 5px;
  text-align: center;
  white-space: nowrap;
}
/* 見出し帯は旧システムと同じ青緑 */
table.yearly-table thead th {
  background: #4aa8bd;
  color: #ffffff;
  font-weight: 600;
}
.yearly-col-name { text-align: left !important; min-width: 170px; }
.yearly-col-rank { width: 56px; font-weight: 600; }
.yearly-col-total { width: 78px; font-weight: 700; }
.yearly-col-cycle { width: 72px; }
/* 最下部の情報行(点検日・担当・天気など)。見出しは右寄せにして帳票と揃える */
.yearly-meta-row td { background: #f4f9fb; }
.yearly-meta-label {
  text-align: right !important;
  font-weight: 600;
  padding-right: 10px !important;
}

/* サイクルごとの情報の入力表。列数が少ないので、横いっぱいに伸ばさず内容に合わせる */
table.yearly-cycle-table { width: auto; min-width: 560px; }
table.yearly-cycle-table th,
table.yearly-cycle-table td { padding: 5px 8px; white-space: nowrap; }
table.yearly-cycle-table input[type="text"],
table.yearly-cycle-table input[type="date"] { width: 130px; min-width: 0; }
/* パターン名が「椿本スタ…」と切れない幅を確保する */
table.yearly-cycle-table select { min-width: 170px; }

/* ---- 印刷(点検実施画面) ----
   メール添付の点検結果報告書(functions/src/sheetPdfLayout.js)と同じ体裁にしている。
   中央の表題は置かず、対象・点検日・部署名・時刻を左に並べ、本体は罫線付きの表にする。
   操作用の部品(写真ボタン・注記ボタン・並べ替え・サインパッド等)は紙には出さない。
   項目数に応じた文字サイズの自動調整は、checksheet.jsがdata-print-densityで指定する。 */
@media print {
  @page { margin: 12mm; }
  html, body { font-size: 10pt; background: #fff; color: #000; }

  /* ---- 年間集計表 ----
     列が多いため横向きで印刷する。ブラウザが名前付きページに対応していない場合は、
     印刷ダイアログで「横」を選べば同じ結果になる。 */
  @page yearly { size: A4 landscape; margin: 10mm; }
  #yearly-report { page: yearly; }
  /* 印刷するのは年間集計表だけ。入力用の表・ボタン・画面見出しは出さない */
  #screen-yearly > h1,
  #screen-yearly .home-controls,
  #screen-yearly #yearly-cycle-box,
  #screen-yearly .yearly-actions,
  #screen-yearly #yearly-note {
    display: none !important;
  }
  #screen-yearly .yearly-table-wrap {
    overflow: visible;
    border: none;
    border-radius: 0;
  }
  .yearly-report-title { margin: 0 0 8px; font-size: 13pt; }
  table.yearly-table { min-width: 0; width: 100%; font-size: 8pt; }
  table.yearly-table th, table.yearly-table td { padding: 3px 2px; }
  /* 背景色は、ブラウザの既定では印刷されないため明示する */
  table.yearly-table thead th {
    background: #4aa8bd !important;
    color: #ffffff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .yearly-meta-row td {
    background: #f4f9fb !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* 画面用に付けている枠・影・角丸・余白は、紙では不要なので消す */
  main > .screen.is-active {
    margin: 0;
    padding: 0;
    max-width: none;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }

  /* 画面操作のための部品は印刷しない */
  .app-header, .sheet-footer, #sheet-title,
  .homework-add-button, .homework-item .homework-save, .homework-camera-btn, .homework-delete-btn,
  .note-btn, .reorder-buttons,
  .col-photo, .homework-column-previous,
  #sign-conditions-wrap, #sign-pad-wrap {
    display: none !important;
  }

  /* ---- 見出し(対象・点検日・部署名・時刻) ---- */
  .sheet-print-header { display: block; margin: 0 0 10px; }
  .sheet-print-header p { margin: 2px 0; font-size: 11pt; }
  .print-time-line .print-time-start { display: inline-block; min-width: 180px; }

  /* ---- 本体の表 ---- */
  #screen-sheet {
    --print-font: 9pt;
    --print-pad: 3px 4px;
    --print-eval: 9pt;
    --print-sign: 150px;
  }
  #screen-sheet[data-print-density="compact"] {
    --print-font: 8pt;
    --print-pad: 2px 3px;
    --print-eval: 8pt;
    --print-sign: 120px;
  }
  #screen-sheet[data-print-density="dense"] {
    --print-font: 7pt;
    --print-pad: 1px 2px;
    --print-eval: 7pt;
    --print-sign: 100px;
  }

  table.sheet-table {
    font-size: var(--print-font);
    border-radius: 0;
    overflow: visible;
    border: 1px solid #333;
    table-layout: fixed;
    width: 100%;
  }
  table.sheet-table th, table.sheet-table td {
    border: 1px solid #333;
    padding: var(--print-pad);
    vertical-align: middle;
    line-height: 1.4;
    color: #000;
  }
  table.sheet-table thead { background: none; }
  table.sheet-table thead th {
    background: none;
    color: #000;
    font-weight: normal;
    font-size: var(--print-font);
  }
  /* No.と分類の見出しは、報告書の体裁に合わせて空欄にする */
  table.sheet-table thead th.col-no,
  table.sheet-table thead th.col-category { font-size: 0; }

  /* 点検役割ごとの行の色分けは画面上だけの補助なので、紙では消す
     (行のstyle属性で背景色を付けているため、!importantで打ち消す) */
  .sheet-row { background: none !important; }
  tbody tr:nth-child(even) { background: none !important; }

  /* 列幅は報告書に合わせる(内容を広く取り、折り返しを減らしてページ数を抑える) */
  .col-no { width: 5%; }
  .col-category { width: 7%; }
  table.sheet-table td.col-content { width: 52%; text-align: left; }
  .col-content { width: 52%; }
  .col-points { width: 8%; }
  .col-eval { width: 8%; }
  .col-score { width: 8%; }
  .col-role { width: 12%; font-size: 0.9em; }

  /* 評価は選ばれた1つだけを文字として残す(ボタンの見た目は消す) */
  .eval-buttons { display: block; height: auto; }
  .eval-btn { display: none; }
  .eval-btn.is-active {
    display: inline;
    border: none !important;
    background: none !important;
    padding: 0;
    margin: 0;
    min-width: 0;
    min-height: 0;
    font-weight: normal;
    font-size: var(--print-eval);
    /* 背景色を印刷しない設定のブラウザでも文字が白抜けして消えないようにする */
    color: #000 !important;
  }
  /* ABC評価は画面上だけ大きく表示しているため、紙では○×と同じ大きさに戻す */
  .eval-buttons-abc .eval-btn.is-active {
    min-height: 0;
    font-size: var(--print-eval);
  }

  .sheet-total-row { background: none !important; font-weight: normal; }
  .sheet-total-row .sheet-total-label { text-align: right; padding-right: 8px; }

  /* ---- 社長の宿題 ---- */
  .homework-box {
    display: block;
    border: 1px solid #333;
    border-radius: 0;
    box-shadow: none;
    padding: 8px 10px;
    margin: 10px 0 0;
  }
  .homework-box .settings-subheading {
    margin: 0 0 4px;
    padding: 0;
    border: none;
    font-size: 10pt;
    font-weight: normal;
  }
  .homework-label { display: none; }
  .homework-list { gap: 2px; margin: 0; }
  .homework-item { display: list-item; list-style: none; padding: 0; }
  .homework-item::before { content: "・"; }
  .homework-item input[type="text"] {
    border: none;
    background: none;
    padding: 0;
    width: 90%;
    font-size: 9pt;
    color: #000;
  }

  /* ---- サイン ---- */
  #sign-section { border: none; }
  #sign-section .settings-subheading { display: none; }
  #sign-completed-wrap {
    display: flex;
    flex-direction: column-reverse; /* HTMLは氏名→画像の順だが、紙では画像→氏名の順にする */
    align-items: flex-end;
    margin-top: 12px;
  }
  #sign-completed-wrap p { margin: 4px 0 0; font-size: 8pt; color: #555; }
  .sign-completed-image {
    display: inline-block;
    max-width: var(--print-sign);
    border: none;
    background: none;
  }
}

/* ==================================================================
   起動画面・トースト・スケルトン・処理中表示
   利用者から「読み込んでいるのか固まっているのか分からない」「保存できたか分からない」
   という状態をなくすための表示をまとめている。
   ================================================================== */

/* ---- 起動画面(スプラッシュ) ----
   ログイン状態の確認が終わるまで被せる。確認中にログイン画面が見えてしまうのを防ぐ。 */
.app-splash {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-muted);
  opacity: 1;
  transition: opacity 0.25s ease;
}
.app-splash.is-leaving { opacity: 0; pointer-events: none; }

.app-splash-inner { text-align: center; padding: 24px; }

.app-splash-logo {
  font-size: 1.9em;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--color-primary);
}
.app-splash-title {
  margin: 2px 0 20px;
  color: var(--color-text-muted);
  font-size: 0.95em;
}
.app-splash-note {
  margin: 14px 0 0;
  color: var(--color-text-muted);
  font-size: 0.9em;
  min-height: 1.6em;
}

/* 起動が終わるまでは本体を隠しておく(中身が一瞬ちらつかないようにする) */
body.is-booting > header.app-header,
body.is-booting > main { visibility: hidden; }

/* ---- くるくる(処理中の印) ---- */
.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-turn 0.7s linear infinite;
  vertical-align: -0.15em;
}
.spinner-lg {
  width: 30px;
  height: 30px;
  border-width: 3px;
  color: var(--color-primary);
}
@keyframes spinner-turn { to { transform: rotate(360deg); } }

/* 処理中のボタン。押せなくしたうえで、文字の前にくるくるを出す */
button.is-busy {
  position: relative;
  color: var(--color-text-muted);
}
button.is-busy::before {
  content: "";
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-right: 6px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-turn 0.7s linear infinite;
  vertical-align: -0.1em;
}

/* ---- トースト(保存しました等の短い知らせ) ----
   画面の下中央に重ねる。iPadを横向きで持っても親指で隠れにくい位置。 */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(560px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  max-width: 100%;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  color: #ffffff;
  background: #333c48;
  font-size: 0.95em;
  line-height: 1.6;
  cursor: pointer;
  animation: toast-in 0.2s ease-out;
}
.toast-success { background: var(--color-green); }
.toast-error { background: var(--color-red); }
.toast-info { background: #37474f; }
.toast.is-leaving { animation: toast-out 0.2s ease-in forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(8px); }
}

/* ---- 通信状態の帯 ---- */
.connection-banner {
  position: sticky;
  top: 0;
  z-index: 900;
  padding: 8px 16px;
  text-align: center;
  font-size: 0.9em;
  color: #ffffff;
}
.connection-banner.is-offline { background: #b26a00; }
.connection-banner.is-online { background: var(--color-green); }

/* ---- スケルトン(読み込み中の骨組み) ----
   表が出てくる場所に薄いグレーの帯を並べ、左から右へ光が流れる動きを付ける。 */
.skeleton-bar {
  display: block;
  height: 1.1em;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, #eef1f4 25%, #e2e7ec 37%, #eef1f4 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}
.skeleton-block { height: 2.2em; margin-bottom: 10px; }
.skeleton-row td { padding: 10px 8px; }

@keyframes skeleton-shimmer {
  from { background-position: 100% 50%; }
  to { background-position: 0 50%; }
}

/* ---- 一覧が0件のときの案内 ---- */
.table-empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--color-text-muted);
}

/* ---- マスタ行の保存状態(各種設定) ---- */
.row-status-cell { white-space: nowrap; }
.row-status {
  font-size: 0.85em;
  color: var(--color-text-muted);
}
.row-status.is-saved { color: var(--color-green); }
.row-status.is-error { color: var(--color-red); }
.row-status.is-saving::before {
  content: "";
  display: inline-block;
  width: 0.75em;
  height: 0.75em;
  margin-right: 5px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-turn 0.7s linear infinite;
  vertical-align: -0.05em;
}

/* ---- 動きを減らす設定(iPadの「視差効果を減らす」など)への対応 ----
   動きに酔いやすい人のために、OS側で動きを減らす設定にしている場合は
   アニメーションを止める。表示する内容そのものは変わらない。 */
@media (prefers-reduced-motion: reduce) {
  .spinner,
  button.is-busy::before,
  .row-status.is-saving::before,
  .skeleton-bar,
  .toast,
  .toast.is-leaving { animation: none; }
  .app-splash { transition: none; }
}

/* ---- 印刷時は画面用の表示を出さない ---- */
@media print {
  .app-splash,
  .toast-host,
  .connection-banner,
  .row-status-cell { display: none !important; }
}

/* ==================================================================
   操作ログ(監査ログ)画面
   ================================================================== */
.auditlog-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin: 12px 0 8px;
}
/* 見出しと入力欄を縦に並べ、どの絞り込みも同じ高さで揃うようにする
   (揃っていないと、どれが何の入力欄か目で追いにくい) */
.auditlog-filters .select-label {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.auditlog-filters input[type="date"],
.auditlog-filters input[type="search"],
.auditlog-filters select {
  min-width: 160px;
  height: 40px;
  box-sizing: border-box;
}
.auditlog-filters button { height: 40px; }

.auditlog-summary {
  margin: 4px 0 8px;
  color: var(--color-text-muted);
  font-size: 0.9em;
}

/* 件数が多くなるため、1行の高さを詰めて一覧性を上げる */
table.auditlog-table th,
table.auditlog-table td {
  padding: 6px 8px;
  font-size: 0.92em;
  vertical-align: top;
}
table.auditlog-table .auditlog-time { white-space: nowrap; }
/* 対象・変更内容は文章になるため左寄せにする(中央寄せだと行をまたいで読みにくい) */
table.auditlog-table td:nth-child(4),
table.auditlog-table td:nth-child(7) { text-align: left; }

/* 名前を引けなかったものはIDを出す。追跡の手がかりとして残しつつ、
   本文と見分けが付くよう薄い等幅で表示する。 */
.auditlog-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
  color: var(--color-text-muted);
  word-break: break-all;
}

.auditlog-more { margin-top: 12px; text-align: center; }

/* ==================================================================
   ヘッダーの社名とアプリ名
   以前は「SANEI LOGO」という仮の文字のままだった。
   ブラウザのタブ名(SANEI 環境整備チェックシート)と同じ並びにする。
   ================================================================== */
.app-header-logo {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
/* 社名の書体は社内の決まりに合わせてMSゴシック。
   iPadなど、その書体が無い端末のために同系統の書体を順に指定しておく。 */
.app-header-brand {
  font-family: "MS Gothic", "ＭＳ ゴシック", "Osaka-Mono", "Hiragino Sans", sans-serif;
  font-weight: 700;
  letter-spacing: 0.12em;
}
.app-header-appname {
  font-weight: 600;
  font-size: 0.92em;
  color: var(--color-text);
}
/* 画面が狭いときは「チェックシート」を省いて「SANEI 環境整備」にする(iPad縦向き・横向きなど)。
   以前は820px以下でアプリ名ごと消していたため、iPadでは「SANEI」だけになり、
   834px(11インチのiPad縦向き)では逆に「環境整備チェックシ」と途中で切れていた。
   スマートフォンほど狭いときは、社名だけを残す。 */
@media (max-width: 1100px) {
  .app-header-appname-rest { display: none; }
}
@media (max-width: 600px) {
  .app-header-appname { display: none; }
  /* スマートフォンでは、社名とベル・アカウントは縮めずに確保し、残りの幅をメニューに使う。
     メニューが入りきらないときは左端からの横スクロールにする
     (中央寄せのままだと、はみ出した左側の「環境整備点検」が見えず、押せなくなっていた。
     また右側のベル・アカウントとメニューが重なっていた)。 */
  .app-header-logo,
  .app-header-user { flex: 0 0 auto; }
  .app-header-nav {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .app-header-nav::-webkit-scrollbar { display: none; }
}

/* ==================================================================
   マスタ表の「内容」「注記」の入力欄
   1行の入力欄だと長い文が途中までしか見えず、編集しづらかった。
   折り返して表示する欄に変え、列にも最低幅を持たせる。
   ================================================================== */
.cell-textarea {
  width: 100%;
  min-height: 3.2em;
  box-sizing: border-box;
  resize: vertical;
  line-height: 1.5;
  font-family: inherit;
  font-size: 1em;
}
table.master-table td.cell-content { min-width: 260px; text-align: left; }
table.master-table td.cell-note { min-width: 150px; text-align: left; }

/* 列を広げたぶん表が横に伸びるため、入りきらないときは表だけ横に動かせるようにする
   (ページ全体が横にずれると、他の操作までしづらくなるため) */
.screen table.master-table { min-width: 100%; }

@media (max-width: 1024px) {
  table.master-table td.cell-content { min-width: 200px; }
  table.master-table td.cell-note { min-width: 120px; }
}

/* ==================================================================
   操作ログの表の収まり
   実行者名やサイクル名が途中で折り返され、1件が2行にも3行にもなって読みにくかった。
   折り返してよいのは文章が入る「対象」と「変更内容」だけにし、
   それ以外の列は折り返さずに幅を確保する。
   ================================================================== */
table.auditlog-table td:nth-child(1),  /* 日時 */
table.auditlog-table td:nth-child(2),  /* 実行者 */
table.auditlog-table td:nth-child(3),  /* 操作 */
table.auditlog-table th { white-space: nowrap; }

/* 点検場所・サイクルは普段は1行に収まるが、サイクルの削除の記録では点検場所が
   「営業、夏見事務所、TST…」と全部並ぶ。以前は折り返さない設定だったため、その1件のせいで
   点検場所の列が極端に広がり、「対象」の列が1文字ずつ縦に並ぶほど狭くなっていた。
   上限の幅を決め、超えた分だけ折り返す。 */
table.auditlog-table td:nth-child(5),
table.auditlog-table td:nth-child(6) {
  min-width: 7em;
  max-width: 14em;
  white-space: normal;
  /* 単語(「74期7サイクル」「夏見事務所」など)の途中では折り返さず、「、」の後ろで折り返す */
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* 変更内容も同じ理由で上限を決める。短いもの(「(未評価) → ○」など)は1行のまま。 */
table.auditlog-table td:nth-child(7) {
  min-width: 9em;
  max-width: 20em;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* 余った幅は「対象」に回す。長い文が入るので折り返すが、狭くなりすぎないよう最低限の幅を取る。 */
table.auditlog-table td:nth-child(4) { width: 100%; min-width: 16em; white-space: normal; }

/* 列が入りきらない狭い画面では、表だけを横に動かせるようにする
   (ページ全体が横にずれると、他の操作までしづらくなるため) */
.auditlog-table-wrap { overflow-x: auto; }

/* ==================================================================
   取り消せない操作のボタン
   サイクル削除のように、押すと元に戻せない操作は見た目で区別する。
   ================================================================== */
button.danger-button {
  border: 1px solid var(--color-red);
  background: #fff;
  color: var(--color-red);
}
button.danger-button:hover:not(:disabled) {
  background: var(--color-red);
  color: #fff;
}

/* ==================================================================
   社長の宿題
   前回の宿題にも「できているか」の確認写真を撮るボタンを置いたため、
   文面とボタンが横に並ぶ形にする。
   ================================================================== */
.homework-item-previous {
  display: flex;
  align-items: center;
  gap: 8px;
}
.homework-previous-text { flex: 1; line-height: 1.5; }
.homework-followup-btn {
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 1.1em;
  overflow: hidden;
}
.homework-followup-btn .photo-btn-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==================================================================
   写真の拡大表示
   一覧やサムネイルの写真を押したとき、画面いっぱいに出す。
   ================================================================== */
.photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.88);
  padding: 24px;
}
.photo-viewer.is-hidden { display: none; }

.photo-viewer-image {
  max-width: 94vw;
  max-height: 86vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: #000;
}
.photo-viewer-close,
.photo-viewer-nav {
  position: absolute;
  background: rgba(255, 255, 255, 0.92);
  border: none;
  color: #222;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 1.6em;
  line-height: 1;
  cursor: pointer;
}
.photo-viewer-close { top: calc(16px + var(--safe-top, 0px)); right: 16px; }
.photo-viewer-prev { left: 16px; }
.photo-viewer-next { right: 16px; }
.photo-viewer-count {
  position: absolute;
  bottom: calc(16px + var(--safe-bottom, 0px));
  color: #fff;
  font-size: 0.95em;
  margin: 0;
}

/* 押すと拡大できる写真であることを示す */
.is-zoomable { cursor: zoom-in; }

@media print {
  .photo-viewer { display: none !important; }
}

/* 宿題のサムネイル(押すと拡大表示する) */
.homework-thumb {
  flex: none;
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

/* ==================================================================
   利用者管理の点検役割
   一覧からそのまま変更できるよう、チェックボックスを縦に並べる。
   ================================================================== */
.inspection-roles-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
  text-align: left;
}
.inspection-role-choice {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.9em;
  white-space: nowrap;
}
.inspection-role-choice input { margin: 0; }

/* ==================================================================
   プレ点検
   本番点検の前に、点検場所を受け持つ人が自分で確認するための画面。
   ================================================================== */
.pre-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.home-pre-cell { white-space: nowrap; }
.pre-btn {
  padding: 6px 12px;
  font-size: 0.9em;
}
.pre-btn.is-done {
  border-color: var(--color-green);
  color: var(--color-green);
}

/* 本番点検の表に出す、プレ点検の結果 */
.col-pre { width: 48px; }
.pre-badge {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  font-size: 0.85em;
}
.pre-badge.is-bad {
  background: #fdecec;
  color: var(--color-red);
}

/* 印刷時はプレ点検の列を出さない(報告書は本番の結果のみ) */
@media print {
  .col-pre { display: none !important; }
  .pre-actions { display: none !important; }
}

/* ==================================================================
   利用者の新規追加フォームの複数選択
   複数選択リストはiPadで選びにくく、何が選ばれているかも分かりにくいため、
   一覧と同じチェックボックスにそろえている。
   ================================================================== */
.add-choice-group {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 10px 8px;
  margin: 0;
  max-height: 150px;
  overflow-y: auto;
}
.add-choice-group legend {
  font-size: 0.82em;
  color: var(--color-text-muted);
  padding: 0 4px;
}
.add-choice-group .inspection-role-choice {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}

/* ==================================================================
   優良改善(★)
   改善一覧の★列と、★を付けた改善を集めた「優良改善」タブ。
   PDF保存はブラウザの印刷機能を使うため、印刷用の見た目もここで定める。
   ================================================================== */
.col-star { width: 44px; text-align: center; }
.star-toggle {
  min-width: 36px;
  min-height: 36px;           /* iPadで押しやすい大きさ */
  padding: 0;
  border: none;
  background: none;
  color: #b8bec6;
  font-size: 1.35em;
  line-height: 1;
  cursor: pointer;
}
.star-toggle.is-on,
.star-mark { color: #e0a800; }
.star-mark { font-size: 1.2em; }

.starred-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin: 8px 0 14px;
}
.starred-toolbar .select-label { margin: 0; }
.starred-toolbar input[type="text"] { flex: 1 1 220px; min-width: 0; }

.starred-print-header { display: none; }

.starred-list { display: flex; flex-direction: column; gap: 14px; }
.starred-card {
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm, 6px);
  background: var(--color-surface);
  padding: 12px 14px;
}
.starred-card-head { display: flex; align-items: center; gap: 8px; }
.starred-card-head h3 { flex: 1; margin: 0; font-size: 1.05em; }
.starred-open { flex: none; }
.starred-meta { margin: 4px 0 10px; color: var(--color-text-muted); font-size: 0.88em; }
.starred-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.starred-photos h4 { margin: 0 0 4px; font-size: 0.85em; color: var(--color-text-muted); }
.starred-photo-row { display: flex; flex-wrap: wrap; gap: 6px; }
.starred-photo.improvement-thumb {
  width: 150px;
  height: 112px;
  object-fit: cover;
}
.starred-no-photo { margin: 0; color: var(--color-text-muted); font-size: 0.85em; }
.starred-details { margin: 10px 0 0; }
.starred-detail { display: flex; gap: 8px; margin: 2px 0; }
.starred-detail dt { flex: none; width: 6.5em; color: var(--color-text-muted); font-size: 0.88em; }
.starred-detail dd { margin: 0; white-space: pre-wrap; }
.starred-by { margin: 8px 0 0; text-align: right; font-size: 0.8em; color: var(--color-text-muted); }

@media (max-width: 600px) {
  .starred-photos { grid-template-columns: 1fr; }
}

/* 優良改善の印刷(PDF保存)。優良改善タブの中身だけを紙に出す */
@media print {
  @page starred { size: A4 portrait; margin: 12mm; }
  body.printing-starred #screen-improvements { page: starred; }
  body.printing-starred #screen-improvements > h1,
  body.printing-starred #screen-improvements .settings-tabs,
  body.printing-starred #improvements-panel-list,
  body.printing-starred #improvements-panel-review,
  body.printing-starred #starred-note,
  body.printing-starred .starred-toolbar,
  body.printing-starred .starred-open,
  body.printing-starred .star-toggle {
    display: none !important;
  }
  body.printing-starred .starred-print-header { display: block; margin: 0 0 8px; }
  body.printing-starred .starred-print-header h2 { margin: 0 0 2px; font-size: 14pt; }
  body.printing-starred .starred-print-header p { margin: 0; font-size: 9pt; }
  body.printing-starred .starred-list { gap: 6mm; }
  body.printing-starred #screen-improvements,
  body.printing-starred #improvements-panel-starred {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
  }
  body.printing-starred .starred-card {
    box-sizing: border-box;
    width: 100%;
    break-inside: avoid;
    page-break-inside: avoid;
    border: 1px solid #999;
    border-radius: 0;
    padding: 4mm;
  }
  body.printing-starred .starred-card-head h3 { font-size: 12pt; }
  body.printing-starred .starred-card-head h3::before { content: "★ "; color: #e0a800; }
  body.printing-starred .starred-card-head .star-mark { display: none; }
  body.printing-starred .starred-meta,
  body.printing-starred .starred-detail { font-size: 9pt; }
  body.printing-starred .starred-photo.improvement-thumb {
    width: auto;
    height: 55mm;
    max-width: 85mm;
    object-fit: contain;
    border: 1px solid #ccc;
  }
  body.printing-starred .starred-card-head h3::before,
  body.printing-starred .star-mark {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ==================================================================
   After写真の依頼URL
   改善参照の画面の発行欄と、ログインなしで開く送信ページ(upload.html)。
   ================================================================== */
.after-link-box {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--color-border-light);
  border-radius: var(--radius-sm);
}
.after-link-box button {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-primary);
}
.after-link-result { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.after-link-result input { flex: 1 1 260px; min-width: 0; font-size: 0.85em; }
.after-link-result .settings-warning { flex-basis: 100%; margin: 0; }

.improvement-photo-thumb { position: relative; }
.photo-via-link {
  position: absolute;
  left: 2px;
  bottom: 2px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(224, 168, 0, 0.92);
  color: #fff;
  font-size: 0.7em;
  pointer-events: none;
}

.upload-page { max-width: 640px; margin: 0 auto; padding: 16px; }
.upload-info { margin: 0 0 12px; }
.upload-info > div { display: flex; gap: 8px; margin: 3px 0; }
.upload-info dt { flex: none; width: 5em; color: var(--color-text-muted); }
.upload-info dd { margin: 0; }
.upload-page h2 { font-size: 1em; margin: 0 0 8px; }
.upload-page label { display: block; margin-bottom: 8px; }
.upload-page input[type="text"] { width: 100%; box-sizing: border-box; }
.upload-pick {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  color: var(--color-primary);
  background: var(--color-surface);
  cursor: pointer;
}
.upload-pick.is-disabled { opacity: 0.45; pointer-events: none; }
.upload-page .improvement-photo-thumb img { width: 140px; height: 105px; object-fit: cover; }
#upload-message.is-error { color: var(--color-danger, #c0392b); }


/* ==================================================================
   見た目が決まっていなかったボタン
   後から追加したボタンが、ブラウザ標準の古い見た目(灰色の立体枠)のまま出ていた。
   ほかの画面の枠線ボタンと同じ形にそろえる。
   ================================================================== */
.pre-btn,
.starred-open,
.cycle-sheet-edit-btn,
.pattern-move-up,
.pattern-move-down,
.pattern-remove,
#starred-print-button,
#auditlog-reload,
#auditlog-csv,
#auditlog-more,
#pre-back,
#pre-complete,
#pre-reopen {
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm, 6px);
  background: var(--color-surface, #fff);
  color: var(--color-primary);
  font-size: 0.92em;
  line-height: 1.3;
  white-space: nowrap;
}
.pre-btn:hover:not(:disabled),
.starred-open:hover:not(:disabled),
.cycle-sheet-edit-btn:hover:not(:disabled),
.pattern-move-up:hover:not(:disabled),
.pattern-move-down:hover:not(:disabled),
.pattern-remove:hover:not(:disabled),
#starred-print-button:hover:not(:disabled),
#auditlog-reload:hover:not(:disabled),
#auditlog-csv:hover:not(:disabled),
#auditlog-more:hover:not(:disabled),
#pre-back:hover:not(:disabled),
#pre-reopen:hover:not(:disabled) {
  background: var(--color-primary-soft);
}
/* よく押す・目立たせたいものは塗りつぶしにする */
#starred-print-button,
#pre-complete {
  background: var(--color-primary);
  color: #fff;
}
#starred-print-button:hover:not(:disabled),
#pre-complete:hover:not(:disabled) { background: var(--color-primary-dark); }
#starred-print-button:disabled,
.pre-btn:disabled { opacity: 0.5; }
/* 済んだプレ点検は、押せるが目立たない見た目にする */
.pre-btn.is-done { border-color: var(--color-border-light); color: var(--color-text-muted); }
/* 取り消せない操作は赤枠 */
.pattern-remove { border-color: var(--color-red); color: var(--color-red); }
/* 並べ替えの矢印は小さくてよい */
.pattern-move-up,
.pattern-move-down { min-width: 36px; padding: 6px 8px; }
/* 操作ログの絞り込み欄と高さをそろえる */
#auditlog-reload,
#auditlog-csv { height: 40px; }

/* ログイン画面の「パスワードの設定・お忘れの方」など、文字だけのボタン */
.login-form button.login-link-button {
  padding: 4px;
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 0.88em;
  text-decoration: underline;
}

/* ユーザー管理のログイン状況 */
.signin-cell { white-space: nowrap; text-align: center; }
.signin-done { color: var(--color-green, #2e8b57); font-weight: 600; }
.signin-never { color: var(--color-red); font-weight: 600; }
.resend-invite-btn {
  margin-top: 4px;
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm, 6px);
  background: var(--color-surface, #fff);
  color: var(--color-primary);
  font-size: 0.85em;
  white-space: nowrap;
}
.resend-invite-btn:hover:not(:disabled) { background: var(--color-primary-soft); }

/* ==================================================================
   更新のお知らせ(public/js/announcements.js)
   ================================================================== */
.announcement-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.45);
}
.announcement-overlay.is-hidden { display: none; }
.announcement-dialog {
  display: flex;
  flex-direction: column;
  width: min(720px, 100%);
  max-height: min(86vh, 900px);
  border-radius: 12px;
  background: var(--color-surface, #fff);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.announcement-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border-light);
  font-weight: 700;
  color: var(--color-primary);
}
.announcement-head button {
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm, 6px);
  background: var(--color-primary);
  color: #fff;
}
.announcement-body { overflow-y: auto; padding: 8px 20px 20px; -webkit-overflow-scrolling: touch; }
.announcement-entry h2 { margin: 12px 0 2px; font-size: 1.15em; }
.announcement-date { margin: 0 0 8px; color: var(--color-text-muted); font-size: 0.85em; }
.announcement-lead { margin: 0 0 6px; }
.announcement-entry h3 {
  margin: 16px 0 6px;
  padding-left: 8px;
  border-left: 4px solid var(--color-primary);
  font-size: 1em;
}
.announcement-entry ul { margin: 0; padding-left: 1.3em; }
.announcement-entry li { margin: 4px 0; line-height: 1.6; }
.announcement-entry.is-past { margin-top: 24px; padding-top: 8px; border-top: 1px dashed var(--color-border-light); }
@media print { .announcement-overlay { display: none !important; } }

/* 宿題の行の削除(×)。カメラと同じ大きさで、押し間違えないよう少し離して置く */
.homework-item button.homework-delete-btn {
  flex: 0 0 auto;
  width: 36px;
  min-height: 36px;
  height: 36px;
  margin-left: 4px;
  padding: 0;
  border: 1px solid var(--color-red);
  border-radius: 50%;
  background: #fff;
  color: var(--color-red);
  font-size: 1.15em;
  font-weight: 700;
  line-height: 1;
}
.homework-item button.homework-delete-btn:hover { background: #fdecec; }
.homework-item button.homework-delete-btn.is-hidden { display: none; }

/* 改善一覧: 検索と種類の絞り込み、社長の宿題の印 */
.improvements-list-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.improvements-list-toolbar input[type="text"] { flex: 1 1 260px; min-width: 0; margin: 0; }
.improvements-list-toolbar select { flex: 0 0 auto; min-height: 40px; }
.kind-badge {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 7px;
  border-radius: 10px;
  background: #fdf3e0;
  border: 1px solid #e8c78a;
  color: #8a5a00;
  font-size: 0.78em;
  font-weight: 700;
  white-space: nowrap;
  vertical-align: 1px;
}

/* 改善一覧の件名: 「社長の宿題」の印の位置をそろえるため、件名の列だけ左寄せにする。
   改善の行にも同じ幅の空きを置いて、件名の書き出しもそろえる。 */
table.master-table td.col-subject { text-align: left; }
.kind-badge.is-blank { visibility: hidden; }
.kind-badge.is-blank::before { content: "社長の宿題"; }
.starred-card-head h3 .kind-badge { font-size: 0.7em; vertical-align: 2px; }

/* 改善一覧の列の収まり。
   件名: 「社長の宿題」の印と件名を横に並べ、2行目以降も件名の書き出しの位置から始める。
   実施者・日付は途中で折り返さない。サイクルは「サイクル名」と「点検日」の2行に分けて出す。 */
#improvements-panel-list .subject-cell { display: flex; align-items: flex-start; gap: 6px; }
#improvements-panel-list .subject-cell .kind-badge { flex: none; margin: 2px 0 0; }
#improvements-panel-list .subject-cell .subject-text { flex: 1; min-width: 0; }
#improvements-panel-list td.col-subject { min-width: 15em; }
#improvements-panel-list td.col-location { min-width: 6em; word-break: keep-all; overflow-wrap: break-word; }
#improvements-panel-list td.col-cycle,
#improvements-panel-list td.col-person,
#improvements-panel-list td.col-date { white-space: nowrap; }
#improvements-panel-list .cycle-date { color: var(--color-text-muted); font-size: 0.85em; }
