/* 第四分団点検アプリ - 共通スタイル
 * ターゲット端末: 1280×800 を想定（タブレット・小型PC）。
 * 固定幅ではなくレスポンシブで、スマホ〜大画面まで対応。
 */

/* Google Fonts - IBM Plex Sans JP */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+JP:wght@400;500;600;700&display=swap');

:root {
  --color-primary: #d32f2f;
  --color-primary-dark: #b71c1c;
  --color-secondary: #1976d2;
  --color-bg: #f0f0f0;
  --color-card: #fff;
  --color-text: #1a1a1a;
  --color-text-muted: #555;
  --color-input-bg: #fffef0;
  --radius: 10px;
  --shadow: 0 3px 12px rgba(0,0,0,0.08);
  --font-size-base: 20px;
  --font-scale: 1.0;
  --bar-height: 56px;
  --modal-width: 480px;
  --modal-width: 700px;
  --modal-actions-gap: 12px;
  --btn-min-height: 3.2em;
  font-size: clamp(12px,2.05vw,20px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar, body::-webkit-scrollbar {
  display: none;
}

body {
  font-family: 'IBM Plex Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  font-size: var(--font-size-base); /* ヘッダー・フッターはbody継承でスケール未適用 */
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ページ遷移アニメーション */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 初回表示時はアニメーションなし（リロード時の斜め動きを防止） */

/* ヘッダー・フッターはスケール未適用（固定サイズ） */
.header,
.bottom-bar {
  font-size: var(--font-size-base);
}

/* ヘッダー（画面上部固定・全幅・高さ固定） */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  width: 100%;
  background: linear-gradient(135deg, #931616 0%, var(--color-primary) 60%, #eb5757 100%);
  color: #fff;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  padding-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  height: var(--bar-height);
  display: flex;
  align-items: center;
  box-sizing: border-box;
}

.header::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -28px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
}

.header__inner {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
}

.header__left {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
}

.header__center {
  display: flex;
  justify-content: center;
}

.header__right {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

/* オンライン/オフライン表示（文字サイズボタンの左） */
.connection-status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid currentColor;
  min-width: 4.5em;
  text-align: center;
}
.connection-status--online {
  color: #ffffff;
  border-color: #ffffff;
  background: #0038ff;
}
.connection-status--offline {
  color: #ffffff;
  border-color: #ffffff;
  background: #565656;
}

/* 設定ボタン（左上・歯車） */
.btn-settings {
  padding: 6px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}
.btn-settings:hover {
  background: rgba(255, 255, 255, 0.4);
}
.btn-settings__icon {
  width: 24px;
  height: 24px;
}

/* 設定モーダル */
.settings-modal__body {
  margin: 16px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.settings-modal__cache-info {
  width: 100%;
  font-size: 1rem;
  color: var(--color-text-muted, #555);
  white-space: pre-line;
  margin-bottom: 4px;
}
.settings-modal__refresh,
.settings-modal__reload {
  flex: 1;
  min-width: 140px;
  margin-bottom: 0;
  min-height: var(--btn-min-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.settings-modal__reload {
  font-size: 0.95rem;
}
.settings-modal__message { font-size: 0.9rem; margin-top: 8px; }
.settings-modal__message--success { color: #2e7d32; }
.settings-modal__message--error { color: #c62828; }

/* 設定パスワード入力（他モーダルと統一・前面表示） */
#settings-password-modal {
  z-index: 2100;
}
.settings-password-modal__content {
  max-width: var(--modal-width);
}
.settings-password__body { margin: 16px 0; }
.settings-password__input {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  border: 2px solid #ddd;
  border-radius: var(--radius);
  box-sizing: border-box;
  font-family: inherit;
}
.settings-password__error { color: #c62828; font-size: 0.9rem; margin-top: 8px; }

.header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
  position: relative;
  z-index: 1;
}

.header--with-back {
  padding-left: 8px;
}

.btn-back {
  display: none;
}

/* 文字サイズ変更ボタン */
.btn-font-size {
  background: rgba(255, 255, 255, 0.4);
  background: #fff;
  /* border: none; */
  color: #000;
  padding: 6px 12px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  /* font-weight: 600; */
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  position: relative;
  z-index: 1;
  transition: background 0.2s, transform 0.2s;
  line-height: 1;
}

.btn-font-size .icon {
  font-size: 1.35rem;
  font-weight: 500;
  width: 1em;
  height: 1em;
  border: 1px solid #000;
  border-radius: 3px;
  background: #000;
  color: #fff;
}

.btn-font-size:hover {
  background: rgba(255, 255, 255, 0.55);
}

.btn-font-size:active {
  transform: scale(0.98);
}

/* 文字サイズモーダル */
.font-size-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  container-type: inline-size;
}

.font-size-modal.active {
  display: flex;
}

/* モーダルはヘッダー・フッター以外なのでスケール適用 */
.font-size-modal .font-size-modal__content,
#settings-password-modal .font-size-modal__content,
.ryohi-modal .ryohi-modal__content,
.inspector-modal .inspector-modal__content,
.inspector-first-modal .inspector-first-modal__content,
.inspector-first-alert-modal .inspector-first-alert-modal__content,
.settings-modal .font-size-modal__content {
  font-size: calc(var(--font-size-base) * var(--font-scale) * 1.2);
}

/* 全モーダル共通幅 */
.font-size-modal__content,
.ryohi-modal__content,
.inspector-modal__content,
.inspector-first-modal__content,
.inspector-first-alert-modal .inspector-first-alert-modal__content,
.settings-modal .font-size-modal__content,
#settings-password-modal .font-size-modal__content {
  width: 90%;
  max-width: var(--modal-width);
  background: #fff;
  border-radius: 16px;
  padding: 24px 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  container-type: inline-size;
}

/* モーダルボタン：1個 or 2個のパターンのみ */
.modal-actions,
.font-size-modal__actions {
  display: flex;
  justify-content: center;
  gap: var(--modal-actions-gap);
  margin-top: 1.5em;
  flex-wrap: wrap;
}
.modal-actions--one .modal-btn,
.modal-actions--one .font-size-modal__btn {
  min-width: 140px;
}
.modal-actions--two {
  display: flex;
  gap: var(--modal-actions-gap);
}
.modal-actions--two .modal-btn,
.modal-actions--two .font-size-modal__btn {
  flex: 1;
  min-width: 0;
}

.font-size-modal__title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.8em;
  text-align: center;
}

.font-size-modal__options {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
  /* max-width: 490px; */
  margin: auto;
}

.font-size-option {
  flex: 1;
  padding: 0.5rem;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  justify-content: center;
  font-size: 2rem;
  line-height: 1.4;
  aspect-ratio: 5 / 3;
}

.font-size-option:hover {
  border-color: #bdbdbd;
  background: #fafafa;
}

.font-size-option.selected {
  border-color: var(--color-primary);
  background: #ffebee;
  /* color: var(--color-primary); */
  font-weight: bold;
}

.font-size-option__label {
  display: block;
  /* font-weight: 600; */
}

.font-size-option[data-scale="0.85"] .font-size-option__label {
  font-size: 75%;
}

.font-size-option[data-scale="1.0"] .font-size-option__label {
  font-size: 100%;
}

.font-size-option[data-scale="1.25"] .font-size-option__label {
  font-size: 135%;
}

.font-size-modal__actions {
  display: flex;
  justify-content: center;
  margin-top: 2.5rem;
}

.font-size-modal__btn {
  min-height: var(--btn-min-height);
  padding: 0 2em;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--color-primary);
  color: #fff;
  width: 60%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.font-size-modal__btn:hover {
  background: var(--color-primary-dark);
}

/* 良否選択モーダル */
.ryohi-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  container-type: inline-size;
}

.ryohi-modal.active {
  display: flex;
}

.ryohi-modal__content {
  background: #fff;
  border-radius: 16px;
  padding: 24px 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  container-type: inline-size;
}

.ryohi-modal__title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 28px;
  text-align: center;
}

.ryohi-modal__options {
  display: flex;
  gap: 12px;
}

.ryohi-option {
  flex: 1;
  min-height: var(--btn-min-height);
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 600;
}

.ryohi-option:hover {
  border-color: #bdbdbd;
  background: #fafafa;
}

.ryohi-option[data-value="良"] {
  color: #2e7d32;
  border-color: #c8e6c9;
}

.ryohi-option[data-value="良"]:hover {
  background: #f1f8f4;
  border-color: #81c784;
}

.ryohi-option[data-value="不良"] {
  color: #c62828;
  border-color: #ffcdd2;
}

.ryohi-option[data-value="不良"]:hover {
  background: #ffebee;
  border-color: #e57373;
}

.ryohi-option[data-value="未確認"] {
  color: #f57c00;
  border-color: #ffe0b2;
}

.ryohi-option[data-value="未確認"]:hover {
  background: #fff3e0;
  border-color: #ffb74d;
}

/* 良否ボタン（テーブル内） */
.ryohi-btn {
  width: 100%;
  min-height: var(--btn-min-height);
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.2s ease;
  text-align: center;
  width: 5em;
}

.ryohi-btn:hover {
  border-color: #bdbdbd;
  background: #fafafa;
}

.ryohi-btn[data-value="良"] {
  color: #2e7d32;
  border-color: #c8e6c9;
  background: #f1f8f4;
}

.ryohi-btn[data-value="不良"] {
  color: #c62828;
  border-color: #ffcdd2;
  background: #ffebee;
}

.ryohi-btn[data-value="未確認"] {
  color: #f57c00;
  border-color: #ffe0b2;
  background: #fff3e0;
}

.ryohi-btn[data-value=""] {
  color: #757575;
}

/* メインコンテンツ（ヘッダー・フッター間のスクロール領域） */
.main {
  flex: 1;
  min-height: 0;
  padding: 16px;
  padding-top: calc(var(--bar-height) + 16px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--bar-height) + 24px + env(safe-area-inset-bottom, 0px));
  overflow-x: clip;
  /* overflow-y: auto; */
  scrollbar-width: none;
  -ms-overflow-style: none;
  font-size: calc(var(--font-size-base) * var(--font-scale));
  display: flex;
  flex-direction: column;
  max-width: 1300px;
  margin: 0 auto;
  width: 100%;
}

.main::-webkit-scrollbar {
  display: none;
}

/* SPAページ切り替え */
.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

/* コンテンツ領域：高さに満たない時は天地中央・超える時は頭揃え */
.main .page.active {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 40px 0;
  box-sizing: border-box;
}

/* 高さに満たないコンテンツ用（TOP, Entry）：中央揃え */
#page-menu.active .card-list,
#page-entry.active .entry-buttons {
  flex: 1;
  display: grid;
  align-content: center;
  justify-content: center;
  gap: 16px;
  min-height: 0;
}

/* 高さを超えるコンテンツ用（List, Form, Detail）：頭揃え */
#page-list.active,
#page-form.active,
#page-detail.active {
  flex: 1;
  min-height: min-content;
  align-items: flex-start;
}

#page-list.active .list-container,
#page-form.active .form,
#page-detail.active .detail-container {
  width: 100%;
}

#page-entry.active .entry-buttons {
  grid-template-columns: repeat(2, 1fr);
}

#page-entry.active #entry-draft-list-wrap,
#page-entry.active #message-entry {
  flex-shrink: 0;
}

/* フッター内コピー用 */
.version-info {
  text-align: center;
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.version-info p {
  margin: 0;
}

.version-info p + p {
  margin-top: 4px;
}

/* カード - アプリ風・タップメインで大きめ・サイズ統一 */
.card-list {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, 1fr);
}

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-card);
  border: none;
  border-radius: 14px;
  padding: 24px 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
  color: inherit;
  flex: 1;
  min-height: 120px;
  aspect-ratio: 2 / 1;
  container-type: inline-size;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.card:active {
  transform: translateY(-1px);
}

.card--primary {
  background: linear-gradient(180deg, #fff 0%, #fff5f5 100%);
  border: 3px solid var(--color-primary);
  color: var(--color-text);
}

.card--primary .card__icon img {
  filter: invert(22%) sepia(95%) saturate(5000%) hue-rotate(355deg);
  opacity: 1;
}

.card--primary:hover {
  background: linear-gradient(180deg, #fff8f8 0%, #ffebee 100%);
  box-shadow: 0 8px 24px rgba(211, 47, 47, 0.15);
}

.card--history {
  background: linear-gradient(180deg, #fff 0%, #f5f8ff 100%);
  border: 3px solid #1976d2;
  color: var(--color-text);
}

.card--history .card__icon img {
  filter: invert(32%) sepia(95%) saturate(2000%) hue-rotate(200deg);
  opacity: 1;
}

.card--history:hover {
  background: linear-gradient(180deg, #f8faff 0%, #e3f2fd 100%);
  box-shadow: 0 8px 24px rgba(25, 118, 210, 0.15);
}

.card--disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
  color: var(--color-text-muted);
  border: 1px solid #ccc;
  aspect-ratio: 3.5/1;
  background: #f5f5f5;
}

.card--disabled .card__title {
  font-size: calc(1.15rem * var(--font-scale));
}
.card--disabled .card__desc {
  opacity: 1;
  font-size: calc(0.75rem * var(--font-scale));
}

.card__icon {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card__icon img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.card--compact {
  aspect-ratio: 2 / 1;
  min-height: 120px;
  padding: 24px 28px;
}

.card--compact .card__title {
  font-size: calc(1.35rem * var(--font-scale));
}

.card--compact .card__desc {
  font-size: calc(0.85rem * var(--font-scale));
}

/* 点検を始める内の2ボタン：TOP同様のgrid・ボタン幅揃え */
.entry-buttons {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 24px;
}

.card__title {
  font-size: calc(1.5rem * var(--font-scale));
  font-weight: 700;
  margin-bottom: 4px;
}

.card--with-icon .card__title {
  font-size: calc(1.35rem * var(--font-scale));
}

.card__desc {
  font-size: calc(0.95rem * var(--font-scale));
  opacity: 0.8;
}

.card--with-icon .card__desc {
  font-size: calc(0.85rem * var(--font-scale));
}

/* ボタン */
.btn {
  background: var(--color-card);
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
  min-height: var(--btn-min-height);
  padding: 0 1.5em;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.btn:hover {
  background: var(--color-primary);
  color: #fff;
}

.btn--primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.btn--primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

.btn--secondary {
  background: var(--color-secondary);
  color: #fff;
  border-color: var(--color-secondary);
}

.btn--danger {
  border-color: #c62828;
  color: #c62828;
}

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

.btn--block {
  width: 100%;
  display: block;
}

/* フォーム */
.form {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
}

.form__group {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
}

.form__label {
  display: block;
  font-weight: 600;
  /* margin-bottom: 6px; */
  color: var(--color-text);
  width: 7em;
}

.form__input,
.form__select,
.form__textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--color-input-bg);
}

.form__input:focus,
.form__select:focus,
.form__textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
}

.form__textarea {
  min-height: 80px;
  resize: vertical;
}

.form__actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

/* メッセージ */
.message {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  display: none;
}

.message--toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  margin: 0;
  max-width: calc(100% - 32px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.message--success {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #81c784;
}

.message--error {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ef5350;
}

/* ローディングオーバーレイ（全画面・バックフィルター） */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.loading-overlay__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.loading-overlay__truck {
  width: 300px;
  height: 120px;
  position: relative;
  overflow: hidden;
}

.loading-overlay__truck-track {
  position: absolute;
  left: 0;
  animation: loading-truck-drive 6s ease-in-out infinite;
}

.loading-overlay__truck-track img {
  display: block;
  width: 120px;
  height: 120px;
  animation: loading-truck-bounce 0.4s ease-in-out infinite;
}

@keyframes loading-truck-drive {
  0% { transform: translateX(180px) scaleX(1); }
  45% { transform: translateX(0) scaleX(1); }
  50% { transform: translateX(0) scaleX(-1); }
  95% { transform: translateX(180px) scaleX(-1); }
  100% { transform: translateX(180px) scaleX(1); }
}

@keyframes loading-truck-bounce {
  0%, 100% { transform: translateY(0); }
  50% {transform: translateY(-4px);}
}

.loading-overlay__text {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
}

.loading-overlay__text::after {
  content: '';
  animation: loading-dots 1.5s steps(4, end) infinite;
}


/* リスト */
.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-item {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}

.list-item:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.list-item__title {
  font-weight: 600;
  margin-bottom: 4px;
}

.list-item__meta {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

/* タブ */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  /* border-bottom: 2px solid #ddd; */
}

.tab {
  background: transparent;
  border: none;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text-muted);
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
}

.tab:hover {
  color: var(--color-primary);
}

.tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* テーブル */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table th,
.table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.table th {
  background: #fafafa;
  font-weight: 600;
  color: var(--color-text);
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover {
  background: #f9f9f9;
}

/* フッター（画面下固定・常時表示・やや透過） */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  width: 100%;
  min-height: var(--bar-height);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -1px 6px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.bottom-bar--copy .bottom-bar__inner {
  justify-content: center;
}

.bottom-bar--copy .version-info {
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

.bottom-bar__inner {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}

.bottom-bar .btn {
  flex: 1 1 auto;
  min-width: 100px;
  margin: 0;
  min-height: var(--btn-min-height);
  padding: 0 1em;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.bottom-bar .btn--full {
  flex: 1 1 100%;
  min-width: 0;
}

@media (max-width: 600px) {
  .bottom-bar .btn {
    flex: 1 1 calc(50% - 4px);
  }
  
  .bottom-bar .btn:only-child,
  .bottom-bar .btn--full {
    flex: 1 1 100%;
  }
}

/* ボタンカラー - ネイティブアプリ風 */
.bottom-bar .btn--back {
  background: #f5f5f5;
  color: #333;
  border: 1px solid #ddd;
}

.bottom-bar .btn--back:active {
  background: #e0e0e0;
}

.bottom-bar .btn--draft {
  background: #fff;
  color: #1976d2;
  border: 1px solid #1976d2;
}

.bottom-bar .btn--draft:active {
  background: #e3f2fd;
}

.bottom-bar .btn--primary {
  background: #d32f2f;
  color: #fff;
  border: 1px solid #d32f2f;
}

.bottom-bar .btn--primary:active {
  background: #b71c1c;
}

.bottom-bar .btn--secondary {
  background: #1976d2;
  color: #fff;
  border: 1px solid #1976d2;
}

.bottom-bar .btn--secondary:active {
  background: #1565c0;
}

.bottom-bar .btn--danger {
  background: #fff;
  color: #d32f2f;
  border: 1px solid #d32f2f;
}

.bottom-bar .btn--danger:active {
  background: #ffebee;
}

/* レスポンシブ */
@media (max-width: 768px) {
  :root {
    --font-size-base: 15px;
  }
  
  .main {
    padding: 12px;
    padding-top: calc(var(--bar-height) + 12px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(var(--bar-height) + 24px + env(safe-area-inset-bottom, 0px));
  }
  
  .card {
    padding: 16px;
  }
  
  .btn {
    padding: 0 20px;
  }
  
  .bottom-bar {
    padding: 10px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
  
  .bottom-bar .btn {
    padding: 0 12px;
    font-size: 14px;
  }
}

/* 縦長（スマホ・ポートレート）：文字大きく・ボタン縦1列 */
@media (orientation: portrait), (max-height: 700px) {
  :root {
    --font-size-base: 17px;
  }
  
  /* 縦長時はカード文字をやや大きく */
  .card__title {
    font-size: calc(1.8rem * var(--font-scale)) !important;
  }
  .card--with-icon .card__title {
    font-size: calc(1.6rem * var(--font-scale)) !important;
  }
  .card__desc {
    font-size: calc(1.1rem * var(--font-scale)) !important;
  }
  .card--with-icon .card__desc {
    font-size: calc(1rem * var(--font-scale)) !important;
  }
  .card--compact .card__title {
    font-size: calc(1.6rem * var(--font-scale)) !important;
  }
  .card--compact .card__desc {
    font-size: calc(1rem * var(--font-scale)) !important;
  }
  .card--disabled .card__title {
    font-size: calc(1.35rem * var(--font-scale)) !important;
  }
  .card--disabled .card__desc {
    font-size: calc(1rem * var(--font-scale)) !important;
  }
  
  /* TOP: ボタン縦1列 */
  #page-menu.active .card-list {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  /* 点検を始める: ボタン縦1列 */
  #page-entry.active .entry-buttons {
    grid-template-columns: 1fr;
  }
}

/* ローディング（list/detailページ内） */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 24px;
}

.loading__animation {
  width: 200px;
  height: 80px;
  position: relative;
  overflow: hidden;
}

.loading__animation-track {
  position: absolute;
  left: 0;
  animation: loading-truck-drive 6s ease-in-out infinite;
}

.loading__animation-bounce {
  width: 80px;
  height: 80px;
  background: url('../icons/vehicle008.svg') center/contain no-repeat;
  animation: loading-truck-bounce 0.4s ease-in-out infinite;
}

.loading__text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.loading__text::after {
  content: '';
  animation: loading-dots 1.5s steps(4, end) infinite;
}

@keyframes loading-dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
  100% { content: ''; }
}

.error-message {
  background: #ffebee;
  color: #c62828;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  text-align: center;
  font-weight: 500;
}

.empty-message {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-muted);
}

.empty-message p {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.list-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: all 0.2s ease;
}

.list-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.list-card:active {
  transform: translateY(0);
}

.list-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f0f0f0;
}

.list-card__date {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
}

.list-card__time {
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

.list-card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-card__info {
  display: flex;
  gap: 8px;
}

.list-card__label {
  font-weight: 600;
  color: var(--color-text-muted);
  min-width: 80px;
}

.list-card__value {
  color: var(--color-text);
}

/* 詳細画面スタイル */
.detail-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.detail-header {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.detail-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-info__row {
  display: flex;
  gap: 12px;
}

.detail-info__label {
  font-weight: 600;
  color: var(--color-text-muted);
  min-width: 100px;
}

.detail-info__value {
  color: var(--color-text);
  font-weight: 500;
}

.detail-section {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.detail-section__title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-primary);
  color: var(--color-text);
}

.table-wrapper {
  overflow-x: auto;
  /* margin: 0 -16px; */
  padding: 1em;
}

.ryohi-cell {
  font-weight: 600;
  text-align: center;
}

.ryohi-良 {
  color: #2e7d32;
  background: #e8f5e9;
}

.ryohi-不良 {
  color: #c62828;
  background: #ffebee;
}

.ryohi-unconfirmed {
  color: #757575;
  background: #f5f5f5;
}

/* 更新通知バナー */
.update-banner {
  position: fixed;
  bottom: calc(var(--bar-height) + env(safe-area-inset-bottom, 16px));
  left: 16px;
  right: 16px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 9000;
  animation: slideUp 0.3s ease-out;
}

.update-banner__text {
  font-size: 0.95rem;
  font-weight: 600;
}

.update-banner__btn {
  background: rgba(255,255,255,0.95);
  color: var(--color-primary);
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.update-banner__btn:hover {
  background: #fff;
}
