/* 社用車乗降管理システム 共通デザイン基盤(管理画面・利用者画面で共用)。
   外部ライブラリ・Webフォント・外部URLは使わない。配色は明るい配色のみ(ダークモードなし)。
   色の組み合わせは WCAG AA(通常文字 4.5:1 以上)を満たす。tests/test_ui_design.py が主要な組み合わせを検証する。 */

:root {
  /* 色: 主色(会社ロゴの藍色)・成功(緑)・警告(橙)・危険(赤)・中立(グレー) */
  --c-primary: #2e3192;
  --c-primary-hover: #23267a;
  --c-primary-soft: #e8e9f7;
  --c-primary-ink: #23267a;
  --c-success: #17803f;
  --c-success-hover: #116632;
  --c-success-soft: #e1f3e8;
  --c-success-ink: #14532d;
  --c-warning: #a8480a;
  --c-warning-soft: #fff0d6;
  --c-warning-ink: #7a3e00;
  --c-danger: #b42318;
  --c-danger-hover: #8f1d12;
  --c-danger-soft: #fde8e6;
  --c-danger-ink: #8f1d12;
  --c-neutral-soft: #e8ebef;
  --c-neutral-ink: #3e4c59;
  /* 情報(青): 運行カレンダーの「見込み」。カレンダーの土日の文字色・過去日の背景(ver1.9.0) */
  --c-info: #1d5fa8;
  --c-info-soft: #e0eefb;
  --c-info-ink: #0f3a66;
  --c-sat: #1d4ed8;
  --c-sun: #b42318;
  --c-past: #eef0f3;
  /* ダッシュボードの入口の色分け(ver1.9.1): 利用者・権限=紫、運行・便・カレンダー=青、車両・QR=緑、運休日=オレンジ、記録・ログ・設定=灰。
     -ink は白地・薄い面の上の文字、本体の色は白い文字・アイコンを載せる丸の背景(どれも白との比が 4.5 以上) */
  --c-cat-user: #6d3fb5;
  --c-cat-user-ink: #4a2788;
  --c-cat-ops: var(--c-info);
  --c-cat-ops-ink: var(--c-info-ink);
  --c-cat-vehicle: var(--c-success);
  --c-cat-vehicle-ink: var(--c-success-ink);
  --c-cat-holiday: var(--c-warning);
  --c-cat-holiday-ink: var(--c-warning-ink);
  --c-cat-record: var(--c-text-muted);
  --c-cat-record-ink: var(--c-neutral-ink);

  /* 背景・面・境界線・文字 */
  --c-bg: #f3f5f8;
  --c-surface: #ffffff;
  --c-surface-alt: #f8fafc;
  --c-border: #d5dbe3;
  --c-border-strong: #9aa5b1;
  --c-text: #1f2933;
  --c-text-muted: #52606d;
  --c-on-color: #ffffff;
  --c-header-bg: #ffffff;
  --c-header-text: #1f2933;
  --c-stripe: #f6f7fb;

  /* 角丸・影 */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.08);
  --shadow-md: 0 2px 8px rgba(16, 24, 40, 0.1);

  /* 余白の段階 */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.75rem;
  --sp-6: 2.5rem;

  /* 文字サイズの段階 */
  --fs-xs: 0.875rem;
  --fs-sm: 1rem;
  --fs-base: 1.0625rem;
  --fs-lg: 1.1875rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 1.875rem;
  --fs-3xl: 2.375rem;

  --font: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --tap: 44px; /* 押しやすさの最小サイズ */
  --focus: 0 0 0 3px rgba(46, 49, 146, 0.45);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.7;
  color: var(--c-text);
  background: var(--c-bg);
}
[hidden] { display: none !important; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
h1 { font-size: var(--fs-xl); line-height: 1.35; }
h2 { font-size: var(--fs-lg); line-height: 1.4; }
h3 { font-size: var(--fs-base); line-height: 1.4; }
a { color: var(--c-primary); text-underline-offset: 2px; }
a:hover { color: var(--c-primary-hover); }
img, svg { max-width: 100%; }

/* フォーカスの見える化 */
:focus-visible { outline: 3px solid var(--c-primary); outline-offset: 2px; box-shadow: var(--focus); }
.skip-link {
  position: absolute; left: var(--sp-2); top: -4rem; z-index: 100;
  padding: var(--sp-2) var(--sp-3); background: var(--c-surface); border: 2px solid var(--c-primary); border-radius: var(--r-sm);
}
.skip-link:focus { top: var(--sp-2); }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ---- アイコン(インライン SVG の線画) ---- */
.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.2em; }
.icon-lg { width: 2.25rem; height: 2.25rem; }
.icon-xl { width: 4.5rem; height: 4.5rem; }

/* ---- 補助クラス ---- */
.text-end { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--c-text-muted); }
.text-danger { color: var(--c-danger); }
.small { font-size: var(--fs-sm); }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--font-mono); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }
.inline-form { display: inline; margin: 0; }

/* ---- ヘッダー ---- */
.app-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 64px; padding: var(--sp-2) var(--sp-4);
  color: var(--c-header-text); background: var(--c-header-bg); border-bottom: 3px solid var(--c-primary); box-shadow: var(--shadow-sm);
}
.app-brand {
  display: inline-flex; align-items: center; gap: var(--sp-3);
  color: var(--c-header-text); font-weight: 700; font-size: var(--fs-base); text-decoration: none;
}
.app-brand:hover { color: var(--c-primary-ink); }
.app-brand small { font-weight: 400; color: var(--c-text-muted); }
.brand-text { line-height: 1.3; }

/* ---- 会社ロゴ(縦横比を保って縮小表示するだけ。変形・着色はしない) ---- */
.logo-mark { display: block; width: auto; height: 40px; flex: none; }
.logo-mark-md { height: 80px; }
.logo-wordmark { display: block; width: auto; height: 28px; flex: none; }
.logo-wordmark-md { height: 40px; }
@media (max-width: 719px) { .app-header .logo-wordmark { display: none; } }
.header-user { margin-left: auto; display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-sm); }
.header-user .who { display: inline-flex; align-items: center; gap: var(--sp-1); max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-user .who > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.header-user .who { min-width: 0; }
.header-logout { margin: 0; }
/* ヘルプリンク(ログイン前の画面にも出る。右端へ寄せ、続くログイン中の表示は隣に詰める) */
.header-help { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: var(--sp-1); min-height: 38px; padding: 0 var(--sp-2); font-size: var(--fs-sm); white-space: nowrap; color: var(--c-header-text); text-decoration: none; border-radius: var(--radius, 6px); }
.header-help:hover { color: var(--c-primary-ink); text-decoration: underline; }
.header-help + .header-user { margin-left: 0; }
@media (pointer: coarse) { .header-help { min-height: 48px; } }
.menu-button { white-space: nowrap; flex: none; }
.brand-text { white-space: nowrap; }
@media (max-width: 479px) {
  .app-header { gap: var(--sp-2); padding-left: var(--sp-3); padding-right: var(--sp-3); }
  .menu-button { padding: 0 var(--sp-2); font-size: var(--fs-xs); }
  .app-brand { flex: none; gap: var(--sp-2); font-size: var(--fs-sm); }
  .app-brand small { display: none; }
  .menu-button ~ .app-brand .logo-mark { display: none; }
  .header-user { gap: var(--sp-2); min-width: 0; }
  .header-logout .btn { padding: 0 var(--sp-2); font-size: var(--fs-xs); }
  .app-header { flex-wrap: wrap; }
  .header-help { padding: 0 var(--sp-1); font-size: var(--fs-xs); }
  .header-help .icon { display: none; }
  .btn-lg.btn-block { font-size: var(--fs-lg); white-space: normal; padding-left: var(--sp-3); padding-right: var(--sp-3); }
}
.app-footer { padding: var(--sp-4); color: var(--c-text-muted); font-size: var(--fs-xs); text-align: center; }
/* 利用者画面: 下部タブバー(固定)に隠れない余白は body.user-body の padding-bottom が確保している */
.user-footer { padding: var(--sp-3) var(--sp-4); }

/* ---- 管理画面の骨格(PC は左サイドナビ、狭い画面はメニューボタンで開閉) ---- */
.nav-toggle-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.menu-button {
  display: none; align-items: center; justify-content: center; gap: var(--sp-1);
  min-width: var(--tap); min-height: var(--tap); padding: 0 var(--sp-3);
  color: var(--c-text); background: var(--c-surface); border: 1px solid var(--c-border-strong); border-radius: var(--r-sm); cursor: pointer;
  font-size: var(--fs-sm);
}
.nav-toggle-input:focus-visible + .app-header .menu-button { outline: 3px solid var(--c-primary); outline-offset: 2px; }
.admin-shell { display: grid; grid-template-columns: 16.5rem minmax(0, 1fr); min-height: calc(100vh - 64px - 3rem); }
.side-nav { padding: var(--sp-4) var(--sp-3); background: var(--c-surface); border-right: 1px solid var(--c-border); }
.side-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-1); }
.side-nav a {
  display: flex; align-items: center; gap: var(--sp-3); min-height: var(--tap); padding: var(--sp-2) var(--sp-3);
  color: var(--c-text); font-weight: 500; text-decoration: none; border-radius: var(--r-sm);
}
/* 項目名が長くても切れないよう、折り返して全部見せる(アイコンは縮めない) */
.side-nav a > span { min-width: 0; overflow-wrap: anywhere; line-height: 1.35; }
.side-nav a > .icon { flex: none; }
.side-nav a:hover { background: var(--c-surface-alt); color: var(--c-text); }
.side-nav a[aria-current="page"] { color: var(--c-primary-ink); background: var(--c-primary-soft); font-weight: 700; box-shadow: inset 4px 0 0 var(--c-primary); }
.side-nav .nav-section { margin: var(--sp-4) var(--sp-3) var(--sp-1); font-size: var(--fs-xs); color: var(--c-text-muted); }
/* 管理画面は PC で見るので広く取る(ver2.1.1・指摘 39・41。1240px → 1680px。1920px の画面でも左右に大きな余白が残らない) */
.admin-main { padding: var(--sp-5) var(--sp-6); min-width: 0; max-width: 1680px; width: 100%; }
.admin-main.is-bare { grid-column: 1 / -1; margin: 0 auto; }

@media (max-width: 959px) {
  .menu-button { display: inline-flex; }
  .admin-shell { display: block; }
  .side-nav { display: none; border-right: 0; border-bottom: 1px solid var(--c-border); box-shadow: var(--shadow-md); }
  .nav-toggle-input:checked ~ .admin-shell .side-nav { display: block; }
  .admin-main { padding: var(--sp-4); }
  .header-user .who { max-width: 26vw; }
}

/* ---- ページ見出し ---- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.page-head h1 { display: flex; align-items: baseline; gap: var(--sp-3); flex-wrap: wrap; }
.page-head .sub { font-size: var(--fs-sm); font-weight: 400; color: var(--c-text-muted); }
.page-lead { margin-bottom: var(--sp-4); color: var(--c-text-muted); max-width: 75em; } /* 全角で約 75 文字(ver2.1.1・指摘 39。以前は 70ch=全角 35 文字ほど) */

/* ---- パンくず(管理画面の下層ページ) ---- */
.breadcrumb { margin-bottom: var(--sp-2); font-size: var(--fs-sm); }
.breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); margin: 0; padding: 0; list-style: none; }
.breadcrumb li + li::before { content: "›"; margin-right: var(--sp-2); color: var(--c-text-muted); }
.breadcrumb [aria-current="page"] { color: var(--c-text-muted); }

/* ---- カード ---- */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); margin-bottom: var(--sp-4); }
.card-fill { height: 100%; margin-bottom: 0; }
.card-head { padding: var(--sp-3) var(--sp-5); font-size: var(--fs-base); font-weight: 700; border-bottom: 1px solid var(--c-border); background: var(--c-surface-alt); border-radius: var(--r-md) var(--r-md) 0 0; display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.card-body { padding: var(--sp-5); }
/* 登録フォーム・確認のカード。広い画面では広がるが、入力欄が間延びしない上限(ver2.1.1・指摘 39。以前は 720px) */
.card-narrow { max-width: 1000px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-4); }
@media (max-width: 959px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 719px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

/* ---- ボタン(最小 44px) ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--tap); padding: var(--sp-2) var(--sp-4);
  font: inherit; font-weight: 700; line-height: 1.3; text-align: center; text-decoration: none; white-space: nowrap;
  color: var(--c-text); background: var(--c-surface); border: 1px solid var(--c-border-strong); border-radius: var(--r-sm);
  cursor: pointer; transition: background-color 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--c-surface-alt); color: var(--c-text); }
.btn-primary { color: var(--c-on-color); background: var(--c-primary); border-color: var(--c-primary); }
.btn-primary:hover { color: var(--c-on-color); background: var(--c-primary-hover); border-color: var(--c-primary-hover); }
.btn-secondary { color: var(--c-primary-ink); background: var(--c-surface); border-color: var(--c-primary); }
.btn-secondary:hover { color: var(--c-primary-ink); background: var(--c-primary-soft); }
.btn-ghost { color: var(--c-text); background: var(--c-surface); border-color: var(--c-border-strong); }
.btn-success { color: var(--c-on-color); background: var(--c-success); border-color: var(--c-success); }
.btn-success:hover { color: var(--c-on-color); background: var(--c-success-hover); border-color: var(--c-success-hover); }
.btn-danger { color: var(--c-on-color); background: var(--c-danger); border-color: var(--c-danger); }
.btn-danger:hover { color: var(--c-on-color); background: var(--c-danger-hover); border-color: var(--c-danger-hover); }
.btn-danger-outline { color: var(--c-danger); background: var(--c-surface); border-color: var(--c-danger); }
.btn-danger-outline:hover { color: var(--c-danger-hover); background: var(--c-danger-soft); }
.btn-sm { padding: var(--sp-1) var(--sp-3); font-size: var(--fs-sm); }
@media (pointer: coarse) { .btn-sm { min-height: 48px; } }
@media (pointer: fine) { .btn-sm { min-height: 38px; } }
.btn-block { display: flex; width: 100%; }
.btn-lg { min-height: 64px; padding: var(--sp-3) var(--sp-4); font-size: var(--fs-xl); border-radius: var(--r-md); }
.btn:disabled, .btn.is-disabled, .btn[aria-disabled="true"] {
  color: #5f6b77; background: #e4e7eb; border-color: #cbd2d9; cursor: not-allowed; opacity: 1;
}
.btn:disabled:hover { background: #e4e7eb; color: #5f6b77; }
.btn-group { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.btn-group .inline-form { display: inline-flex; }

/* ---- フォーム ---- */
.field { margin-bottom: var(--sp-5); }
.field:last-child { margin-bottom: 0; }
.field-label { display: block; margin-bottom: var(--sp-1); font-weight: 700; font-size: var(--fs-sm); }
.field-label.small { font-weight: 600; }
.field-label.required::after { content: "必須"; margin-left: var(--sp-2); padding: 1px 6px; font-size: var(--fs-xs); font-weight: 700; color: var(--c-danger-ink); background: var(--c-danger-soft); border-radius: var(--r-sm); }
.field-hint { margin-top: var(--sp-1); font-size: var(--fs-sm); color: var(--c-text-muted); }
.field-error { margin-top: var(--sp-1); font-size: var(--fs-sm); color: var(--c-danger-ink); font-weight: 600; }
.input {
  display: block; width: 100%; min-height: var(--tap); padding: var(--sp-2) var(--sp-3);
  font: inherit; color: var(--c-text); background: var(--c-surface);
  border: 1px solid var(--c-border-strong); border-radius: var(--r-sm);
}
textarea.input { min-height: 5.5rem; resize: vertical; }
.input:focus { outline: 3px solid var(--c-primary); outline-offset: 1px; border-color: var(--c-primary); }
.input:disabled { color: var(--c-text-muted); background: var(--c-neutral-soft); }
/* 運行管理システム(VOM)が正本の項目を、入力欄でなく表示だけにするときの見た目(ver2.8.0 車両管理) */
.sync-readonly {
  min-height: 40px; padding: var(--sp-1) var(--sp-2); display: flex; align-items: center;
  color: var(--c-text-muted); background: var(--c-neutral-soft); border: 1px dashed var(--c-border-strong); border-radius: var(--r-sm);
  font-size: var(--fs-sm); overflow-wrap: anywhere;
}
.input-sm { min-height: 40px; padding: var(--sp-1) var(--sp-2); font-size: var(--fs-sm); }
.check { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--tap); margin-right: var(--sp-3); cursor: pointer; }
.check input { width: 1.25rem; height: 1.25rem; accent-color: var(--c-primary); }
.checks { display: flex; flex-wrap: wrap; }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }
.filter-bar { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--sp-3) var(--sp-4); align-items: end; }
.filter-bar .field { margin-bottom: 0; }

/* 12 分割のグリッド(フォームの横並び用。狭い画面では縦積み) */
.row { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--sp-3) var(--sp-4); }
.row.align-end { align-items: end; }
.row.tight { gap: var(--sp-2); }
.row > * { grid-column: span 12; min-width: 0; }
.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }
@media (min-width: 720px) {
  .col-md-2 { grid-column: span 2; }
  .col-md-3 { grid-column: span 3; }
  .col-md-4 { grid-column: span 4; }
  .col-md-6 { grid-column: span 6; }
  .col-md-8 { grid-column: span 8; }
  .col-md-9 { grid-column: span 9; }
}
/* ナンバーの分割入力(車両管理)。同じ幅・同じ高さの欄を等間隔に並べ、狭い画面では折り返す。 */
.plate-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: var(--sp-3) var(--sp-4); align-items: end; }
.plate-grid .field { margin-bottom: 0; min-width: 0; }
.plate-grid .plate-submit { align-self: end; }
.filter-bar > * { grid-column: span 12; }
@media (min-width: 720px) {
  .filter-bar .f-3 { grid-column: span 3; }
  .filter-bar .f-4 { grid-column: span 4; }
  .filter-bar .f-6 { grid-column: span 6; }
  .filter-bar .f-2 { grid-column: span 2; }
}
@media (max-width: 719px) { .filter-bar .f-half { grid-column: span 6; } }

/* 説明リスト(項目名と値) */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--sp-2) var(--sp-4); margin-bottom: var(--sp-3); }
.kv dt { color: var(--c-text-muted); font-size: var(--fs-sm); }
.kv dd { font-weight: 600; }

/* ---- 表(PC は表、狭い画面は各行をカード状に縦積み) ----
   表の入れ物は縦にスクロールさせない(ページのスクロールだけにする)。横は、画面が狭いときだけ横スクロールできる。 */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.table thead th { padding: var(--sp-3); text-align: left; white-space: nowrap; font-weight: 700; color: var(--c-text-muted); background: var(--c-surface-alt); border-bottom: 2px solid var(--c-border-strong); }
.table td { padding: var(--sp-3); vertical-align: middle; border-bottom: 1px solid var(--c-border); }
.table tbody tr:nth-child(even) { background: var(--c-stripe); }
.table tbody tr:hover { background: var(--c-primary-soft); }
.table tbody tr.row-muted { background: var(--c-neutral-soft); color: var(--c-text-muted); }
.table th.text-end, .table td.text-end { text-align: right; }
.table td.text-end { font-variant-numeric: tabular-nums; }
/* 数値・日時は右寄せの等幅数字、操作ボタンは右端に揃える */
.table .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); white-space: nowrap; }
.table th.num { font-family: var(--font); }
.table td .input-num { text-align: right; font-variant-numeric: tabular-nums; }
.table .dt { font-variant-numeric: tabular-nums; white-space: nowrap; }
/* 操作列は、見出しもボタンも左寄せ(ver2.2.0)。行ごとにボタンの数が違っても、ボタンの左端が縦にそろう。
   操作列のボタンは <div class="btn-group btn-group-nowrap"> に入れ、並び順はページ内で固定する。 */
.table th.th-actions, .table td.cell-actions { text-align: left; }
.table td.cell-actions .btn-group { justify-content: flex-start; }
.table details summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; color: var(--c-primary-ink); }
/* 1人1行を低くまとめた一覧(利用者・パスキー・管理者の表)。1行目に主な項目、2行目に小さく補足を出す */
.table-compact td { padding: var(--sp-2) var(--sp-3); line-height: 1.35; }
.table .cell-main { font-weight: 700; }
.table .cell-sub { display: flex; flex-wrap: wrap; gap: 2px var(--sp-2); align-items: center; font-size: var(--fs-xs); color: var(--c-text-muted); }
.table .boarding-item { white-space: nowrap; }
.btn-group-nowrap { flex-wrap: nowrap; }
.table-compact .btn-group { gap: var(--sp-1); }
@media (pointer: fine) { .table-compact .btn-sm { min-height: 30px; padding: 2px var(--sp-2); } }
/* 利用者一覧(幅 1280px 程度のウィンドウで横スクロール無しに全列が見える。狭い幅では .table-wrap の横スクロールに戻る) */
.tbl-users { table-layout: fixed; min-width: 50rem; }
.tbl-users thead th, .tbl-users td { padding-left: var(--sp-2); padding-right: var(--sp-2); }
.tbl-users td { padding-top: var(--sp-1); padding-bottom: var(--sp-1); line-height: 1.3; vertical-align: top; overflow-wrap: anywhere; }
.tbl-users .col-person { width: 10.5rem; }
.tbl-users .col-contact { width: auto; }
.tbl-users .col-boarding { width: 11.5rem; }
.tbl-users .col-status { width: 6.5rem; }
.tbl-users .col-actions { width: 12rem; }
.tbl-users .cell-sub { gap: 0 var(--sp-2); }
.tbl-users .boarding-item { white-space: normal; }
.tbl-users td .badge { white-space: normal; border-radius: var(--r-md); }
.tbl-users td.cell-actions { white-space: nowrap; }
.tbl-users td.cell-actions .btn-group { flex-wrap: nowrap; }
.tbl-users td.cell-actions .btn-sm { padding: 2px var(--sp-2); }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-3); }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding: var(--sp-1) 0; }

@media (max-width: 719px) {
  .btn-group-nowrap { flex-wrap: wrap; }
  .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr, .table-stack tbody tr:nth-child(even) { margin-bottom: var(--sp-3); padding: var(--sp-2) var(--sp-3); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
  .table-stack tbody tr.row-muted { background: var(--c-neutral-soft); }
  .table-stack td.num, .table-stack td.dt { text-align: right; }
  .table-stack td { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-2) 0; border-bottom: 1px dashed var(--c-border); text-align: right; }
  .table-stack td:last-child { border-bottom: 0; }
  .table-stack td[data-label]::before { content: attr(data-label); flex: none; max-width: 40%; font-weight: 700; font-size: var(--fs-xs); color: var(--c-text-muted); text-align: left; }
  .table-stack td > .input, .table-stack td > form { max-width: 62%; margin-left: auto; }
  .table-stack td.cell-actions, .table-stack td.cell-wide { display: block; text-align: left; }
  .table-stack td.cell-actions::before, .table-stack td.cell-wide::before { display: block; max-width: none; margin-bottom: var(--sp-1); }
  .table-stack td.cell-wide > *, .table-stack td.cell-wide > form { max-width: none; }
  .table-stack td:empty { display: none; }
  .table-stack td > .cell-body { flex: 1 1 auto; min-width: 0; text-align: right; overflow-wrap: anywhere; }
  .table-stack td > .cell-body .cell-sub { justify-content: flex-end; }
  .table-stack td .badge { white-space: normal; border-radius: var(--r-md); }
  .table-stack .boarding-item { white-space: normal; }
  .tbl-users { min-width: 0; table-layout: auto; }
  .tbl-users td { padding-top: var(--sp-2); padding-bottom: var(--sp-2); }
  .table-stack td.cell-id { display: none; }
  .table-stack td.cell-title { display: block; padding-top: 0; font-size: var(--fs-base); font-weight: 700; text-align: left; }
  .table-stack td.cell-title::before { display: none; }
  .table-stack td.cell-nolabel::before { display: none; }
  .tbl-passkeys td:nth-child(4)::before { content: "有効なパスキー"; flex: none; font-weight: 700; font-size: var(--fs-xs); color: var(--c-text-muted); }
  .tbl-passkeys td:nth-child(1) { font-weight: 700; justify-content: flex-start; flex-wrap: wrap; text-align: left; }
}

/* ---- 通知(フラッシュメッセージ・注意書き) ---- */
.notice { display: flex; align-items: flex-start; gap: var(--sp-3); margin-bottom: var(--sp-4); padding: var(--sp-3) var(--sp-4); border: 1px solid; border-left-width: 6px; border-radius: var(--r-sm); }
.notice .icon { margin-top: 0.15em; }
.notice > div { min-width: 0; }
.notice-success { color: var(--c-success-ink); background: var(--c-success-soft); border-color: var(--c-success); }
.notice-warning { color: var(--c-warning-ink); background: var(--c-warning-soft); border-color: var(--c-warning); }
.notice-danger { color: var(--c-danger-ink); background: var(--c-danger-soft); border-color: var(--c-danger); }
.notice-info { color: var(--c-primary-ink); background: var(--c-primary-soft); border-color: var(--c-primary); }
.notice ul { margin: var(--sp-2) 0 0; padding-left: 1.25rem; }
.notice a { color: inherit; font-weight: 700; }

/* ---- 状態バッジ(色だけに頼らず、記号と文字を併記する) ---- */
.badge { display: inline-flex; align-items: center; gap: 0.4em; padding: 2px 10px; font-size: var(--fs-xs); font-weight: 700; line-height: 1.5; white-space: nowrap; border-radius: 999px; border: 1px solid transparent; color: var(--c-neutral-ink); background: var(--c-neutral-soft); }
.badge::before { content: ""; width: 0.6em; height: 0.6em; border-radius: 50%; background: currentColor; flex: none; }
.badge-info { color: var(--c-primary-ink); background: var(--c-primary-soft); border-color: #bcbfe6; }
.badge-success { color: var(--c-success-ink); background: var(--c-success-soft); border-color: #a9d8bb; }
.badge-warning { color: var(--c-warning-ink); background: var(--c-warning-soft); border-color: #f0c78a; }
.badge-danger { color: var(--c-danger-ink); background: var(--c-danger-soft); border-color: #f1b5af; }
.badge-neutral { color: var(--c-neutral-ink); background: var(--c-neutral-soft); border-color: #cbd2d9; }
/* 便の状態: 記号の形でも区別する(●=進行中、◆=待機、■=終了、▲=走行中) */
.badge-st-CREATED::before { border-radius: 2px; transform: rotate(45deg); }
.badge-st-BOARDING::before { border-radius: 50%; }
.badge-st-READY::before { border-radius: 50%; box-shadow: 0 0 0 2px var(--c-success-soft), 0 0 0 3px currentColor; }
.badge-st-DEPARTED::before { width: 0; height: 0; background: transparent; border-radius: 0; border-left: 0.35em solid transparent; border-right: 0.35em solid transparent; border-bottom: 0.65em solid currentColor; }
.badge-st-ARRIVED::before { border-radius: 2px; }
.badge-st-ALIGHTING::before { border-radius: 50%; }
.badge-st-COMPLETED::before { border-radius: 2px; }
.badge-st-CANCELLED { text-decoration: line-through; }
.badge-lg { padding: 4px 14px; font-size: var(--fs-sm); }

/* ---- 空状態・タイル ---- */
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); padding: var(--sp-5) var(--sp-4); text-align: center; color: var(--c-text-muted); }
.empty .icon { width: 2.5rem; height: 2.5rem; color: var(--c-border-strong); }
.tile { display: flex; flex-direction: column; gap: var(--sp-2); height: 100%; padding: var(--sp-4); color: var(--c-text); text-decoration: none; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.tile:hover { color: var(--c-text); border-color: var(--c-primary); box-shadow: var(--shadow-md); }
.tile-title { display: flex; align-items: center; gap: var(--sp-2); font-weight: 700; font-size: var(--fs-lg); }
.tile-title .icon { width: 1.6rem; height: 1.6rem; color: var(--c-primary); }
/* 種類ごとの色分け(ダッシュボード): 左に色の帯、アイコンは色付きの丸の中。 */
.cat-user { --cat-color: var(--c-cat-user); --cat-ink: var(--c-cat-user-ink); }
.cat-ops { --cat-color: var(--c-cat-ops); --cat-ink: var(--c-cat-ops-ink); }
.cat-vehicle { --cat-color: var(--c-cat-vehicle); --cat-ink: var(--c-cat-vehicle-ink); }
.cat-holiday { --cat-color: var(--c-cat-holiday); --cat-ink: var(--c-cat-holiday-ink); }
.cat-record { --cat-color: var(--c-cat-record); --cat-ink: var(--c-cat-record-ink); }
.tile[class*="cat-"] { border-left: 6px solid var(--cat-color); }
.tile[class*="cat-"]:hover { border-color: var(--cat-color); }
.tile[class*="cat-"] .tile-title .icon { flex: none; box-sizing: border-box; width: 2.4rem; height: 2.4rem; padding: 0.5rem; color: var(--c-on-color); background: var(--cat-color); border-radius: 50%; }
.tile[class*="cat-"] .tile-cta { color: var(--cat-ink); }
.tile-body { flex: 1; font-size: var(--fs-sm); color: var(--c-text-muted); }
.tile-cta { display: inline-flex; align-items: center; gap: var(--sp-1); font-weight: 700; font-size: var(--fs-sm); color: var(--c-primary-ink); }

/* ---- 初期設定の進み具合(ダッシュボードの「はじめにやること」) ---- */
.setup-card summary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); min-height: var(--tap); padding: var(--sp-3) var(--sp-5); font-weight: 700; cursor: pointer; }
.setup-card[open] summary { border-bottom: 1px solid var(--c-border); background: var(--c-surface-alt); border-radius: var(--r-md) var(--r-md) 0 0; }
.setup-meter { flex: 1 1 8rem; max-width: 16rem; }
.setup-list { list-style: none; margin: 0; padding: var(--sp-2) var(--sp-5) var(--sp-4); }
.setup-item { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--c-border); }
.setup-item:last-child { border-bottom: 0; }
/* PC 幅では、項目ごとに列をそろえる(アイコン・名称・状態・件数・ボタン)。ボタンの左端が縦にそろう(ver2.2.0)。狭い幅は従来どおり折り返す。 */
@media (min-width: 720px) {
  .setup-item { display: grid; grid-template-columns: 1.5rem minmax(0, 1fr) 6rem 10rem 15rem; column-gap: var(--sp-3); }
  .setup-item .btn { justify-self: start; }
}
.setup-item .icon { width: 1.5rem; height: 1.5rem; }
.setup-item.is-done .icon { color: var(--c-success); }
.setup-item.is-todo .icon { color: var(--c-warning); }
.setup-label { flex: 1 1 14rem; font-weight: 600; }
.setup-item[class*="cat-"] .btn-secondary { color: var(--cat-ink); border-color: var(--cat-color); }
.setup-item[class*="cat-"] .btn-secondary:hover { color: var(--cat-ink); }
.setup-hint { display: block; font-weight: 400; font-size: var(--fs-sm); color: var(--c-text-muted); }

/* ---- 本日の運行カード ---- */
.op-vehicle { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); font-size: var(--fs-lg); font-weight: 700; }
.op-vehicle .icon { color: var(--c-primary); width: 1.75rem; height: 1.75rem; }
.op-trips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-3); }
.op-trip { padding: var(--sp-3); background: var(--c-surface-alt); border: 1px solid var(--c-border); border-radius: var(--r-md); }
.op-trip-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-2); font-weight: 700; }
.op-trip-times { font-size: var(--fs-sm); color: var(--c-text-muted); }
/* 便の取り消し・強制終了（理由の入力と操作ボタン。左寄せ・ボタンは折り返さない） */
.op-close-form { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: var(--sp-2); margin-top: var(--sp-2); }
.op-close-form .input { flex: 1 1 12rem; min-width: 0; }
.op-close-all { margin-bottom: var(--sp-3); }
.op-close-all p { flex-basis: 100%; margin: 0; }
@media (max-width: 479px) { .op-trips { grid-template-columns: minmax(0, 1fr); } }

/* ---- 認証画面(中央のカード) ---- */
.auth-wrap { width: 100%; max-width: 27rem; margin: var(--sp-5) auto; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.auth-title { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-4); text-align: center; }
.auth-title .icon { width: 3rem; height: 3rem; color: var(--c-primary); }
.auth-title small { display: block; font-size: var(--fs-sm); font-weight: 400; color: var(--c-text-muted); }
.auth-lead { margin-bottom: var(--sp-4); color: var(--c-text-muted); }
.auth-sub { margin-top: var(--sp-4); font-size: var(--fs-sm); text-align: center; }
.code-input { min-height: 64px; font-size: var(--fs-2xl); letter-spacing: 0.2em; text-align: center; text-transform: uppercase; font-family: var(--font-mono); }
.display-code { margin: var(--sp-2) 0 var(--sp-4); font-size: var(--fs-3xl); font-weight: 700; letter-spacing: 0.15em; font-family: var(--font-mono); }

/* ---- 利用者画面(スマホ縦画面を最優先) ---- */
body.user-body { padding-bottom: 6rem; font-size: 1.125rem; }
.user-main { width: 100%; max-width: 32rem; margin: 0 auto; padding: var(--sp-4); }
.user-main .card-body { padding: var(--sp-4); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center;
  background: var(--c-surface); border-top: 1px solid var(--c-border); box-shadow: 0 -2px 8px rgba(16, 24, 40, 0.08);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar ul { list-style: none; margin: 0; padding: 0; display: flex; width: 100%; max-width: 32rem; }
.tabbar li { flex: 1; }
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 64px; padding: var(--sp-1); color: var(--c-text-muted); font-size: var(--fs-xs); font-weight: 600; text-decoration: none;
}
.tabbar a .icon { width: 1.5rem; height: 1.5rem; }
.tabbar a[aria-current="page"] { color: var(--c-primary-ink); box-shadow: inset 0 3px 0 var(--c-primary); background: var(--c-primary-soft); }

.big { font-size: var(--fs-lg); font-weight: 700; margin: 0 0 var(--sp-3); }
.muted { color: var(--c-text-muted); font-size: var(--fs-sm); }
.warn { color: var(--c-danger-ink); }
.updated { text-align: right; }

.board-card { text-align: center; }
.board-vehicle { display: flex; align-items: center; justify-content: center; gap: var(--sp-2); font-size: var(--fs-2xl); font-weight: 700; line-height: 1.3; }
.board-vehicle .icon { color: var(--c-primary); width: 2rem; height: 2rem; }
.board-trip { margin: var(--sp-2) 0; }
.board-name { margin: var(--sp-3) 0; font-size: var(--fs-xl); font-weight: 700; }
.board-sentence { margin-bottom: var(--sp-4); color: var(--c-text-muted); font-size: var(--fs-sm); }
.result-icon { display: block; margin: 0 auto var(--sp-3); width: 6rem; height: 6rem; }
.result-ok { color: var(--c-success); }
.result-info { color: var(--c-primary); }
.result-warn { color: var(--c-warning); }
.result-ng { color: var(--c-danger); }
.result-title { margin-bottom: var(--sp-2); font-size: var(--fs-xl); font-weight: 700; }

.driver-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.live { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-xs); color: var(--c-text-muted); }
.live-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--c-success); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.vehicle-name { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-2xl); font-weight: 700; line-height: 1.3; }
.vehicle-name .icon { color: var(--c-primary); width: 1.75rem; height: 1.75rem; }
.trip-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.trip-head h2 { font-size: var(--fs-xl); }
.trip .btn-lg { margin-top: var(--sp-2); }
.trip-reason { margin: var(--sp-2) 0 0; font-weight: 700; color: var(--c-danger-ink); }
.confirm-box { padding: var(--sp-3); border: 2px solid var(--c-danger); border-radius: var(--r-md); background: var(--c-danger-soft); display: flex; flex-direction: column; gap: var(--sp-2); }
.confirm-box .big { color: var(--c-danger-ink); margin: 0; }
.meter { display: block; width: 100%; height: 0.9rem; margin: var(--sp-2) 0 var(--sp-3); appearance: none; -webkit-appearance: none; border: 0; border-radius: 999px; background: var(--c-neutral-soft); overflow: hidden; }
.meter::-webkit-progress-bar { background: var(--c-neutral-soft); border-radius: 999px; }
.meter::-webkit-progress-value { background: var(--c-success); border-radius: 999px; }
.meter::-moz-progress-bar { background: var(--c-success); border-radius: 999px; }
.roster { display: flex; flex-direction: column; }
.roster-todo { order: -1; } /* 画面の上に未乗車(未降車)者、下に乗車済み(降車済み)者。HTML の並びは変えない */
.roster-group { margin-top: var(--sp-2); }
.roster h3 { margin: var(--sp-3) 0 var(--sp-1); font-size: var(--fs-base); }
.person-list { list-style: none; margin: 0; padding: 0; }
.person-list li { display: flex; align-items: center; gap: var(--sp-2); min-height: 48px; padding: var(--sp-2) 0; border-bottom: 1px solid var(--c-border); }
.person-name { font-size: var(--fs-lg); font-weight: 700; }
.person-meta { margin-left: auto; font-size: var(--fs-sm); color: var(--c-text-muted); }
.person-list .icon { color: var(--c-success); }
.not-yet .icon { color: var(--c-warning); }
.not-yet .person-name { color: var(--c-danger-ink); }

/* 申請・予定の一覧(カード) */
.item-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.item-date { font-size: var(--fs-lg); font-weight: 700; }
.item-sub { margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--c-text-muted); }
.item-dim { color: var(--c-text-muted); }
.item-actions { margin-top: var(--sp-3); }
.item-strong { font-weight: 700; color: var(--c-primary-ink); }
.status-cancelled { color: var(--c-text-muted); text-decoration: line-through; }

/* ---- 画面ごとの補助 ---- */
.form-split { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
.form-split > :only-child { grid-column: 1 / -1; max-width: 1000px; }
@media (max-width: 959px) { .form-split { grid-template-columns: minmax(0, 1fr); } }
.vehicle-qr { max-width: 240px; margin: 0 auto; }
.url-break { word-break: break-all; }
/* 発行完了画面の登録用リンクのQR(その場で本人のスマホに読み取らせるため大きく出す) */
.qr-screen { margin: var(--sp-2) 0; }
.qr-screen svg { display: block; width: min(20rem, 100%); height: auto; background: #fff; }

/* ---- ページ送り ---- */
.pager { display: flex; align-items: center; justify-content: center; gap: var(--sp-3); margin-top: var(--sp-4); }
.pager-page { font-size: var(--fs-sm); color: var(--c-text-muted); }

/* ---- 管理画面の追加(段階 D2) ---- */
.json-view { margin: 0; padding: var(--sp-3); overflow: auto; max-height: 60vh; font-family: var(--font-mono); font-size: var(--fs-sm); white-space: pre-wrap; word-break: break-all; background: var(--c-surface-alt); border: 1px solid var(--c-border); border-radius: var(--r-sm); }
.setting-group { margin: 0 0 var(--sp-3); font-size: var(--fs-lg, 1.125rem); }
.setting-item { padding: var(--sp-4) 0; border-top: 1px solid var(--c-border); }
.setting-item:first-of-type { border-top: 0; padding-top: 0; }
.setting-item .field-hint { max-width: 70ch; }
.setting-meta { margin-top: var(--sp-1); font-size: var(--fs-sm); color: var(--c-text-muted); }

@media print { .app-header, .side-nav, .tabbar, .app-footer, .menu-button { display: none !important; } }

/* 月のカレンダー(運休日の画面・運行カレンダーで共通。ver1.9.0 で色分けのカレンダーへ。部品は templates/admin/_calendar.html)。
   PC 幅は 7 列の表(日付は左上・マスは一定の高さ)、スマホ幅(479px 以下)は日付ごとに縦に並べる。
   状態は色だけでなく札の文字(確定・見込み・運休日)でも区別する(印刷しても分かる)。土曜は青・日曜は赤の文字。 */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.cal-toolbar-side { flex: 1 1 0; display: flex; gap: var(--sp-2); align-items: center; min-width: 0; }
.cal-toolbar-side.is-end { justify-content: flex-end; }
.cal-title { margin: 0; font-size: var(--fs-2xl); font-weight: 700; text-align: center; white-space: nowrap; }
.cal { width: 100%; table-layout: fixed; border-collapse: collapse; background: var(--c-surface); }
.cal th.cal-head { padding: var(--sp-2); font-size: var(--fs-sm); text-align: center; color: var(--c-text); background: var(--c-neutral-soft); border: 1px solid var(--c-border-strong); }
.cal th.cal-head.cal-sun { color: var(--c-sun); }
.cal th.cal-head.cal-sat { color: var(--c-sat); }
.cal-cell { position: relative; height: 6.75rem; padding: var(--sp-1) var(--sp-2); vertical-align: top; border: 1px solid var(--c-border-strong); overflow-wrap: anywhere; background: var(--c-surface); color: var(--c-text); }
.cal-cell.is-outside { background: var(--c-surface-alt); color: var(--c-text-muted); }
.cal-cell.is-outside .cal-num { font-weight: 400; color: var(--c-text-muted); opacity: 0.6; }
.cal-cell.is-past { background: var(--c-past); color: var(--c-text-muted); }
.cal-cell.is-today { outline: 3px solid var(--c-primary); outline-offset: -3px; }
.cal-sat .cal-num { color: var(--c-sat); }
.cal-sun .cal-num { color: var(--c-sun); }
.cal-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-1); }
.cal-daynum { display: inline-flex; align-items: baseline; flex: 0 0 auto; white-space: nowrap; }
.cal-num { font-weight: 700; font-size: var(--fs-xl); line-height: 1.2; }
.cal-dow { display: none; margin-left: 0.1em; font-weight: 700; font-size: var(--fs-sm); }
.cal-today-tag { padding: 0 8px; font-size: var(--fs-xs); font-weight: 700; line-height: 1.5; color: var(--c-on-color); background: var(--c-primary); border-radius: 999px; white-space: nowrap; }
.cal-tag { display: block; max-width: 100%; margin-top: var(--sp-1); padding: 1px 8px; overflow: hidden; font-size: var(--fs-xs); font-weight: 700; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; border-radius: var(--r-sm); border: 1px solid transparent; }
.cal-tag-holiday { color: var(--c-warning-ink); background: var(--c-surface); border-color: var(--c-warning); }
.cal-tag-confirmed { color: var(--c-success-ink); background: var(--c-surface); border-color: var(--c-success); }
.cal-tag-forecast { color: var(--c-info-ink); background: var(--c-surface); border-color: var(--c-info); }
.cal-cell.is-holiday { background: var(--c-warning-soft); color: var(--c-warning-ink); box-shadow: inset 0.4rem 0 0 var(--c-warning); padding-left: calc(var(--sp-2) + 0.3rem); }
.cal-cell.is-holiday .cal-num { color: var(--c-warning-ink); }
.cal-cell.is-holiday.is-past { opacity: 0.8; }
.cal-link { position: absolute; inset: 0; display: block; width: 100%; height: 100%; padding: var(--sp-1) var(--sp-2); margin: 0; font: inherit; text-align: left; color: inherit; text-decoration: none; background: transparent; border: 0; cursor: pointer; }
.cal-cell.is-holiday .cal-link { padding-left: calc(var(--sp-2) + 0.3rem); }
.cal-link.is-disabled { cursor: default; }
.cal-holiday-button { color: inherit; }
.cal-add { display: block; margin-top: var(--sp-2); font-size: var(--fs-xs); font-weight: 700; color: var(--c-primary-ink); opacity: 0; }
.cal-hint { display: block; margin-top: var(--sp-1); font-size: var(--fs-xs); font-weight: 600; color: var(--c-warning-ink); opacity: 0; }
.cal-cell.is-open:hover, .cal-cell.is-open:focus-within { background: var(--c-primary-soft); }
.cal-cell.is-holiday.is-open:hover, .cal-cell.is-holiday.is-open:focus-within { background: #ffe2ad; }
.cal-cell.is-open:hover .cal-add, .cal-cell.is-open:focus-within .cal-add, .cal-cell.is-open:hover .cal-hint, .cal-cell.is-open:focus-within .cal-hint { opacity: 1; }
.cal-cell .inline-form { display: block; }
.cal-daylink { text-decoration: underline; color: var(--c-primary-ink); }
.cal-count { margin-top: var(--sp-1); font-size: var(--fs-xl); font-weight: 700; line-height: 1.2; white-space: nowrap; }
.cal-trips { margin: var(--sp-1) 0 0; padding: 0; list-style: none; font-size: var(--fs-xs); line-height: 1.4; }
.cal-trips li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-trips .cal-more { font-weight: 700; }
.cal-seat { font-weight: 700; }
.cal-seat.is-over { color: var(--c-danger-ink, #b3261e); }
.cal-daydetail { display: block; margin-top: var(--sp-1); font-size: var(--fs-xs); font-weight: 700; text-decoration: underline; color: var(--c-primary-ink); }
.day-trip { margin-top: var(--sp-4); }
.cal-top-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px var(--sp-1); min-width: 0; }
.cal-top .cal-tag { margin-top: 0; }
.cal-name { display: block; margin-top: var(--sp-1); overflow: hidden; font-size: var(--fs-xs); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.cal-none { margin-top: var(--sp-2); font-size: var(--fs-xs); color: var(--c-text-muted); }
.cal-ops .cal-cell { height: auto; min-height: 7rem; }
.cal-cell.state-confirmed { background: var(--c-success-soft); color: var(--c-success-ink); }
.cal-cell.state-forecast { background: var(--c-info-soft); color: var(--c-info-ink); }
.cal-cell.state-holiday { background: var(--c-warning-soft); color: var(--c-warning-ink); box-shadow: inset 0.4rem 0 0 var(--c-warning); padding-left: calc(var(--sp-2) + 0.3rem); }
.cal-cell.state-none { color: var(--c-text-muted); }
.cal-cell.state-confirmed .cal-num, .cal-cell.state-forecast .cal-num { color: inherit; }
.cal-cell.state-holiday .cal-num { color: var(--c-warning-ink); }
.cal-cell.cal-sat.state-confirmed .cal-num, .cal-cell.cal-sat.state-forecast .cal-num { color: var(--c-sat); }
.cal-cell.cal-sun.state-confirmed .cal-num, .cal-cell.cal-sun.state-forecast .cal-num { color: var(--c-sun); }
.cal-legend { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); margin: 0 0 var(--sp-3); padding: 0; list-style: none; font-size: var(--fs-sm); }
.cal-legend li { display: inline-flex; align-items: center; gap: var(--sp-2); }
.cal-legend li strong { white-space: nowrap; }
.cal-swatch { display: inline-block; width: 1.5rem; height: 1.1rem; border: 1px solid var(--c-border-strong); border-radius: 3px; background: var(--c-surface); }
.cal-swatch.state-confirmed { background: var(--c-success-soft); border-color: var(--c-success); }
.cal-swatch.state-forecast { background: var(--c-info-soft); border-color: var(--c-info); }
.cal-swatch.state-holiday { background: var(--c-warning-soft); border-color: var(--c-warning); box-shadow: inset 0.3rem 0 0 var(--c-warning); }
.cal-swatch.state-past { background: var(--c-past); }
.cal-swatch.state-today { border: 3px solid var(--c-primary); }
.cal-swatch.state-none { background: var(--c-surface); }
.cal-swatch, .cal-cell, .cal-tag, .cal-today-tag { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
@media (max-width: 479px) {
  .cal-toolbar { flex-wrap: wrap; }
  .cal-title { order: -1; flex: 1 0 100%; font-size: var(--fs-xl); }
  .cal, .cal tbody, .cal tr, .cal td { display: block; width: auto; }
  .cal thead { display: none; }
  .cal-cell, .cal-ops .cal-cell { height: auto; min-height: 0; margin-bottom: -1px; }
  .cal-cell.is-outside { display: none; }
  .cal-dow { display: inline; }
  .cal-top { justify-content: flex-start; gap: var(--sp-3); align-items: center; }
  .cal-num { font-size: var(--fs-lg); }
  .cal-link { position: static; display: block; height: auto; min-height: 2.75rem; padding: 0; }
  .cal-cell.is-holiday .cal-link { padding-left: 0; }
  .cal-add, .cal-hint { opacity: 1; }
  .cal-trips li, .cal-name { white-space: normal; }
  .cal-top-tags { justify-content: flex-start; }
}
@media (hover: none) { .cal-add, .cal-hint { opacity: 1; } }

/* ---- iPhone 幅(479px 以下)のフォーム・ボタン・入力の整理(ver2.0.0 段階A・実地確認の指摘 33) ----
   横並びのフォームは縦 1 列、入力欄・ボタンは幅いっぱいで高さ・角丸・余白をそろえる。
   入力欄の文字は 16px 以上(iOS が入力時に拡大しない)。保存・キャンセルは縦に積み、主ボタンを上にする。 */
@media (max-width: 479px) {
  .card-body { padding: var(--sp-4); }
  .card-head { padding: var(--sp-3) var(--sp-4); }
  .field { margin-bottom: var(--sp-4); }
  .field-label { margin-bottom: var(--sp-2); }

  .input, select.input, textarea.input, input.input {
    width: 100%; max-width: 100%; min-width: 0; min-height: 48px;
    padding: var(--sp-2) var(--sp-3); font-size: max(16px, 1rem); line-height: 1.4; border-radius: var(--r-md);
  }
  /* iOS の日付・時刻の入力は既定の見た目だと高さ・文字位置が他の欄とずれるため、素の見た目をやめてそろえる。 */
  input.input[type="date"], input.input[type="time"], input.input[type="month"], input.input[type="datetime-local"] {
    -webkit-appearance: none; appearance: none; display: block; text-align: left;
  }
  .input::-webkit-date-and-time-value { min-height: 1.4em; text-align: left; }
  .input-sm { min-height: 44px; font-size: max(16px, 1rem); }

  /* 横並びの 2〜4 列は縦 1 列 */
  .row > [class*="col-"], .filter-bar > *, .filter-bar .f-half { grid-column: span 12; }
  .plate-grid { grid-template-columns: minmax(0, 1fr); }
  .plate-grid .plate-submit { align-self: stretch; }
  .filter-bar { gap: var(--sp-3); }

  /* ボタンの並びは縦に積み、主ボタンを上に。押しやすい高さは 44px 以上 */
  .form-actions, .btn-group { flex-direction: column; align-items: stretch; }
  .form-actions .btn, .btn-group .btn, .btn-group .inline-form, .btn-group .inline-form .btn, .filter-bar .btn, .plate-grid .btn {
    width: 100%; min-height: 48px;
  }
  .form-actions .btn-primary, .btn-group .btn-primary { order: -1; }
  .form-actions .btn-group, .table .btn-group { flex-direction: row; }
  .table .btn-group .btn { width: auto; }
  .table td.cell-actions .btn-group { flex-direction: column; }
  .table td.cell-actions .btn-group .btn { width: 100%; }
  .cluster .btn { min-height: 44px; }

  /* 表: 表は入れ物の中だけ横にスクロールし、ページ全体は広げない */
  .table-wrap { max-width: 100%; -webkit-overflow-scrolling: touch; }

  /* 長い文字列(アドレス・コード)ははみ出さず折り返す */
  .access-urls, .access-url-item, .url-break, .entry-url, .qr-url { overflow-wrap: anywhere; word-break: break-all; }
}

/* 入口のアドレスの表示(指摘 27): 管理画面の上部は小さく、登録完了画面は大きく */
.access-urls { display: flex; flex-direction: column; gap: var(--sp-1); margin: 0 0 var(--sp-4); font-size: var(--fs-sm); color: var(--c-text-muted); }
.access-url-item { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); }
.entry-url-box { margin-bottom: var(--sp-4); padding: var(--sp-3) var(--sp-4); background: var(--c-primary-soft); border-radius: var(--r-md); }
.entry-url-label { margin: 0 0 var(--sp-1); font-size: var(--fs-sm); font-weight: 700; color: var(--c-primary-ink); }
.entry-url { margin: 0; font-size: var(--fs-xl); font-weight: 700; color: var(--c-primary-ink); word-break: break-all; }

/* ---- ver2.1.1(実地確認の指摘 37・40) ---- */
/* 37: 運休日の登録欄。日付・名前・登録ボタンを同じ高さ・下端そろえで 1 行(PC 幅)。ラベルの高さもそろえる。
   スマホ幅(479px 以下)は縦 1 列(段階 A の作法)。 */
.holiday-form { display: grid; grid-template-columns: 11rem minmax(0, 1fr) auto; gap: var(--sp-3) var(--sp-4); align-items: end; }
.holiday-form .field-label { display: flex; align-items: center; min-height: 1.75rem; margin-bottom: var(--sp-2); line-height: 1.5; white-space: nowrap; }
.holiday-form .holiday-field { min-width: 0; }
.holiday-form .holiday-field .input { width: 100%; }
.holiday-field-date .input { min-width: 0; }
.holiday-field-name .input { min-width: 0; }
.holiday-form .holiday-submit .btn { white-space: nowrap; }
.holiday-name-hint { margin: var(--sp-2) 0 0; }
@media (max-width: 719px) { .holiday-form { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 479px) {
  .holiday-form .field-label { white-space: normal; }
  .holiday-form .holiday-submit .btn { width: 100%; min-height: 48px; }
}
/* 37: 「この月の土日をまとめて運休日にする」。ボタンの下に説明を置き、1 文字目から折り返してこぼれないようにする。 */
.weekends-form { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.weekends-form .field-hint { margin-top: 0; max-width: 60em; }
@media (max-width: 479px) { .weekends-form { align-items: stretch; } .weekends-form .btn { width: 100%; min-height: 48px; white-space: normal; } }

/* 40: システム管理のタイル。見出しは折り返さず 1 行(狭い幅だけ折り返す)。タイルの高さは grid の行でそろう。 */
.grid-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-4); }
.grid-tiles .tile-title { flex-wrap: nowrap; }
.grid-tiles .tile-title .icon { flex: none; }
@media (max-width: 719px) { .grid-tiles { grid-template-columns: minmax(0, 1fr); } .grid-tiles .tile-title { flex-wrap: wrap; } }
/* 40: セキュリティの設定の項目名と値。値(バッジ)は項目名の隣で折り返さない。 */
.kv-wide { grid-template-columns: max-content minmax(0, 1fr); gap: var(--sp-3) var(--sp-6); align-items: center; }
.kv-wide dd { margin: 0; }
@media (max-width: 479px) { .kv-wide { grid-template-columns: minmax(0, 1fr); gap: var(--sp-1); } }
