/* =====================================================================
   関東サービス 警備管制ダッシュボード テーマ
   ---------------------------------------------------------------------
   ・明るめの管制UI（白背景 / 濃紺アクセント #1f3a5f 系）
   ・status 色は意味固定（on_duty=緑 / late=赤 / not_arrived=灰 /
     on_break=橙 / finished=青灰 / absent=濃赤）
   ・コントラスト比 4.5:1 以上（本文・ラベル・ボタン）
   ・外部フォント禁止（システムフォントスタックのみ）
   ・file:// で開いて動く。ビルド無し・CDN無し
   ・日本語UI: 行間 1.6 前後 / 余白十分 / 情報密度高めでも読める
   ・レスポンシブ: PC管制室メイン + スマホ閲覧可（最小幅 360px）
   ===================================================================== */

/* ---------------------------------------------------------------------
   トークン（:root）
   --------------------------------------------------------------------- */
:root {
  /* 面・線・文字 */
  --bg:        #eef1f5;   /* アプリ全体の下地（薄いグレー青） */
  --surface:   #ffffff;   /* カード・テーブル等の面 */
  --surface-2: #f5f7fa;   /* 面の中の控えめゾーン（thead 等） */
  --line:      #d3d9e2;   /* 罫線・境界（対 white 約 1.4:1。装飾用） */
  --line-strong:#b7c0cd;  /* 強めの罫線 */
  --text:      #1f2937;   /* 本文（対 white 約 13:1） */
  --muted:     #5b6573;   /* 補足文字（対 white 約 5.4:1 → AA 合格） */

  /* ブランド（濃紺アクセント） */
  --brand:      #1f3a5f;  /* 主アクセント（対 white 約 9.6:1） */
  --brand-700:  #16304f;  /* 押下・濃いめ */
  --brand-300:  #4f6f96;  /* ホバー薄め・サブ */
  --brand-tint: #e8eef6;  /* ブランドの極薄面（選択中ナビ等） */
  --focus:      #2563eb;  /* フォーカスリング（青） */

  /* セマンティック status 色（背景=極薄 / 文字=濃色で AA 確保） */
  --ok:          #1e7d46;  /* 緑（対 white 約 4.9:1） on_duty */
  --ok-bg:       #e3f4ea;
  --warn:        #b15c00;  /* 橙（対 white 約 4.7:1） on_break */
  --warn-bg:     #fbeedd;
  --danger:      #c2261b;  /* 赤（対 white 約 5.4:1） late */
  --danger-bg:   #fbe5e3;
  --absent:      #7a1f17;  /* 濃赤（対 white 約 9.1:1） absent */
  --absent-bg:   #f4e2e0;
  --finished:    #3b5a73;  /* 青灰（対 white 約 6.3:1） finished */
  --finished-bg: #e7edf2;
  --neutral:     #5b6573;  /* 灰（対 white 約 5.4:1） not_arrived */
  --neutral-bg:  #eceef1;

  /* 形状・影 */
  --radius:    10px;
  --radius-sm: 7px;
  --radius-lg: 14px;
  --shadow:    0 1px 2px rgba(20, 33, 53, .06), 0 2px 8px rgba(20, 33, 53, .07);
  --shadow-sm: 0 1px 2px rgba(20, 33, 53, .08);

  /* タイポ・間隔 */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN",
          "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, "Noto Sans JP",
          system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;
  --lh:   1.6;          /* 日本語本文の行間 */
  --gap:  16px;         /* 標準ガター */
  --pad:  18px;         /* カード内パディング */
}

/* ---------------------------------------------------------------------
   リセット & ベース
   --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: var(--lh);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "palt" 1;   /* 日本語の詰め組（読みやすさ） */
}

h1, h2, h3, h4, p { margin: 0; }

/* 日本語見出しの文節改行ユニット（助詞だけ孤立させない用） */
.ln { display: inline-block; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 共通フォーカス可視化（キーボード操作のアクセシビリティ） */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* スクロールバー（管制室の長尺リスト向けに細め） */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------------
   アプリシェル & トップナビ
   --------------------------------------------------------------------- */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 18px;
  height: 56px;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 0 var(--brand-700), 0 2px 10px rgba(20, 33, 53, .18);
  overflow-x: auto;            /* スマホで横スクロール可 */
  scrollbar-width: none;
}
.topnav::-webkit-scrollbar { display: none; }

.topnav .brand {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .02em;
  white-space: nowrap;
  margin-right: 14px;
  padding-right: 14px;
  border-right: 1px solid rgba(255, 255, 255, .25);
  color: #fff;
}
.topnav .brand small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  opacity: .8;
  line-height: 1.2;
}
.topnav .spacer { flex: 1 1 auto; }

.nav-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, .82);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  line-height: 1.4;
  transition: background-color .12s ease, color .12s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.nav-item.active {
  background: #fff;
  color: var(--brand);
}
.nav-item:focus-visible { outline-color: #fff; outline-offset: 2px; }

/* ---------------------------------------------------------------------
   ページ & ヘッダ
   --------------------------------------------------------------------- */
.page {
  flex: 1 1 auto;
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 20px 22px 56px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.page-head h1 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--text);
  line-height: 1.4;
}
.page-head .sub {
  color: var(--muted);
  font-size: 13px;
}
.page-head .actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------------
   レイアウト：グリッド / 行 / 列
   --------------------------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gap);
}
/* 列スパン（grid 内）：.col / .col-N */
.col { grid-column: span 12; }
.col-2  { grid-column: span 2; }
.col-3  { grid-column: span 3; }
.col-4  { grid-column: span 4; }
.col-5  { grid-column: span 5; }
.col-6  { grid-column: span 6; }
.col-7  { grid-column: span 7; }
.col-8  { grid-column: span 8; }
.col-9  { grid-column: span 9; }
.col-12 { grid-column: span 12; }

/* 横並びの行（フォーム・ツールバー等） */
.row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--gap);
}
.row.tight { gap: 8px; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }

/* ---------------------------------------------------------------------
   カード & KPI
   --------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--pad);
}
.card + .card { margin-top: var(--gap); }

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -2px 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}
.card-head .sub { color: var(--muted); font-size: 12px; }
.card-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* KPI カード（数値主役。色帯で意味づけ可） */
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 15px 17px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 92px;
}
.kpi .kpi-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .01em;
}
.kpi-num {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.kpi-num .unit {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 3px;
}
.kpi .kpi-foot {
  font-size: 12px;
  color: var(--muted);
}
/* KPI の意味色（左帯） */
.kpi.is-ok       { border-left-color: var(--ok); }
.kpi.is-warn     { border-left-color: var(--warn); }
.kpi.is-danger   { border-left-color: var(--danger); }
.kpi.is-finished { border-left-color: var(--finished); }

/* ---------------------------------------------------------------------
   ボタン階層
   --------------------------------------------------------------------- */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  padding: 9px 15px;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease, color .12s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* 主：濃紺（白文字 約 9.6:1） */
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--brand-700); border-color: var(--brand-700); }

/* 副：枠線のみ（ゴースト） */
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--brand);
}
.btn-ghost:hover { background: var(--brand-tint); border-color: transparent; }

/* 破壊的：赤（白文字 約 5.4:1） */
.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #a31f15; border-color: #a31f15; }

/* サイズ違い */
.btn.sm { min-height: 32px; padding: 6px 11px; font-size: 13px; }
.btn.lg { min-height: 44px; padding: 12px 20px; font-size: 15px; }
.btn.block { width: 100%; }

/* ---------------------------------------------------------------------
   フォーム：field / input / select / slider
   --------------------------------------------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field > label, .field .label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.field .hint { font-size: 11.5px; color: var(--muted); }
.field.inline { flex-direction: row; align-items: center; gap: 10px; }

.input, .select, textarea.input {
  appearance: none;
  width: 100%;
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  min-height: 38px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.input::placeholder, textarea.input::placeholder { color: #98a1b0; }
.input:hover, .select:hover { border-color: var(--brand-300); }
.input:focus, .select:focus, textarea.input:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .18);
}
.input:disabled, .select:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
textarea.input { min-height: 84px; resize: vertical; }

/* select の三角アイコン（外部画像なし・グラデで描画） */
.select {
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* スライダー（最適化の重み調整など） */
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  cursor: pointer;
  outline-offset: 4px;
}
.slider::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: transparent; }
.slider::-moz-range-track { height: 6px; border-radius: 999px; background: var(--line); }
.slider::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--brand-300); }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid #fff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .1s ease;
}
.slider::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid #fff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.slider:hover::-webkit-slider-thumb { transform: scale(1.08); }
.slider:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(37, 99, 235, .25); }
.slider:disabled { opacity: .5; cursor: not-allowed; }

/* スライダー行：ラベル + 値表示 */
.slider-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px 12px;
}
.slider-row .slider-val {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 13px;
  color: var(--brand);
  min-width: 3ch;
  text-align: right;
}

/* ---------------------------------------------------------------------
   テーブル（ヘッダ sticky / 行ホバー / ゼブラ）
   --------------------------------------------------------------------- */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
  background: var(--surface);
}
/* スクロール容器（縦sticky を効かせるため overflow を付ける親に使う） */
.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  max-height: 70vh;
}

.table thead th {
  position: relative;
  text-align: left;
  font-weight: 700;
  color: var(--text);
  background: var(--surface-2);
  padding: 11px 14px;
  white-space: nowrap;
  border-bottom: 2px solid var(--line-strong);
  letter-spacing: .01em;
}
/* sticky ヘッダ */
.table.sticky thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  box-shadow: 0 1px 0 var(--line-strong);
}

.table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  vertical-align: middle;
  line-height: 1.5;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:nth-child(even) td { background: #fafbfd; }       /* ゼブラ（控えめ） */
.table tbody tr:hover td { background: var(--brand-tint); }       /* 行ホバー */
.table tbody tr.is-selected td { background: #dbe6f4; box-shadow: inset 3px 0 0 var(--brand); }

/* セル装飾ユーティリティ */
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .center { text-align: center; }
.table .nowrap { white-space: nowrap; }
.table .code { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }

/* ---------------------------------------------------------------------
   バッジ（状態ラベル小）
   --------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  letter-spacing: .01em;
}
.badge-ok     { color: var(--ok);      background: var(--ok-bg);      border-color: #bfe3cd; }
.badge-warn   { color: var(--warn);    background: var(--warn-bg);    border-color: #f0d6b4; }
.badge-danger { color: var(--danger);  background: var(--danger-bg);  border-color: #f1c4c0; }
.badge-muted  { color: var(--muted);   background: var(--neutral-bg); border-color: #d6dae0; }

/* ---------------------------------------------------------------------
   ボード（管制：現場×ポストのグリッド + status-dot）
   --------------------------------------------------------------------- */
.board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.board-cell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 12px 13px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 96px;
  transition: box-shadow .12s ease, border-color .12s ease;
}
.board-cell:hover { box-shadow: var(--shadow); }

.board-cell .bc-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.board-cell .bc-title {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.4;
  flex: 1 1 auto;
  min-width: 0;
}
.board-cell .bc-sub { font-size: 11.5px; color: var(--muted); }
.board-cell .bc-time {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.board-cell .bc-person {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
}

/* board-cell をステータスで左帯色付け（任意） */
.board-cell.s-on_duty     { border-left-color: var(--ok); }
.board-cell.s-late        { border-left-color: var(--danger); }
.board-cell.s-not_arrived { border-left-color: var(--neutral); }
.board-cell.s-on_break    { border-left-color: var(--warn); }
.board-cell.s-finished    { border-left-color: var(--finished); }
.board-cell.s-absent      { border-left-color: var(--absent); }
.board-cell.is-unfilled {
  border-style: dashed;
  border-left-style: solid;
  border-left-color: var(--danger);
  background: var(--danger-bg);
}

/* status-dot：意味的に固定された色（凡例 legend と一致） */
.status-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--neutral);
  border: 1.5px solid rgba(0, 0, 0, .08);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .9);
  vertical-align: middle;
}
.status-dot.not_arrived { background: var(--neutral); }                         /* 未到着=灰 */
.status-dot.late        { background: var(--danger); }                          /* 遅刻=赤 */
.status-dot.on_duty     { background: var(--ok); }                              /* 警備中=緑 */
.status-dot.on_break    { background: var(--warn); }                            /* 休憩=橙 */
.status-dot.finished    { background: var(--finished); }                        /* 退勤=青灰 */
.status-dot.absent      { background: var(--absent); }                          /* 欠勤=濃赤 */
/* on_duty は「今まさに稼働」を強調するため微弱な発光リング */
.status-dot.on_duty { box-shadow: 0 0 0 2px rgba(255, 255, 255, .9), 0 0 0 4px rgba(30, 125, 70, .25); }

/* 凡例 */
.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  font-size: 12.5px;
  color: var(--muted);
}
.legend .legend-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

/* ---------------------------------------------------------------------
   pill（フィルタ/トグル小チップ）& empty（空状態）
   --------------------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}
.pill:hover { background: var(--surface-2); border-color: var(--brand-300); }
.pill.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.pill.active:hover { background: var(--brand-700); }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.empty .empty-title { font-size: 14px; font-weight: 700; color: var(--text); }
.empty .empty-sub { font-size: 13px; }

/* ---------------------------------------------------------------------
   小物ユーティリティ
   --------------------------------------------------------------------- */
.muted { color: var(--muted); }
.num   { font-variant-numeric: tabular-nums; }
.mono  { font-family: var(--mono); }
.right { margin-left: auto; }
.divider { height: 1px; background: var(--line); border: 0; margin: 16px 0; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------------
   レスポンシブ（最小幅 360px まで閲覧可）
   --------------------------------------------------------------------- */

/* タブレット幅：12カラムを 6 基調へ寄せる */
@media (max-width: 1024px) {
  .page { padding: 18px 16px 48px; }
  .col-2, .col-3, .col-4 { grid-column: span 6; }
  .col-5, .col-7, .col-8, .col-9 { grid-column: span 12; }
  .board { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
}

/* スマホ（閲覧用）：1カラム・タップ領域確保・情報は縦積み */
@media (max-width: 640px) {
  body { font-size: 14.5px; }

  .topnav { height: 52px; padding: 0 12px; }
  .topnav .brand { font-size: 15px; margin-right: 10px; padding-right: 10px; }
  .nav-item { padding: 8px 11px; }

  .page { padding: 14px 12px 44px; }
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 18px; }
  .page-head .actions { width: 100%; margin-left: 0; }

  .grid { grid-template-columns: 1fr; gap: 12px; }
  .col, [class*="col-"] { grid-column: 1 / -1; }

  .card { padding: 14px; border-radius: var(--radius-sm); }
  .kpi-num { font-size: 26px; }

  .board { grid-template-columns: 1fr; }

  /* テーブルは横スクロールで全列維持（管制データを欠落させない） */
  .table-wrap { max-height: 62vh; }
  .table { font-size: 13px; }
  .table thead th, .table tbody td { padding: 9px 11px; }

  /* タップ領域：ボタン・入力は 40px 以上 */
  .btn { min-height: 40px; }
  .input, .select, .btn { font-size: 15px; }   /* iOS 自動ズーム抑止 */

  .row.actions-stack { flex-direction: column; align-items: stretch; }
  .row.actions-stack .btn { width: 100%; }
}

/* 最小幅 360px の保険：はみ出し防止 */
@media (max-width: 360px) {
  .page { padding: 12px 10px 40px; }
  .card { padding: 12px; }
  .kpi-num { font-size: 24px; }
}

/* ---------------------------------------------------------------------
   アクセシビリティ：モーション削減 / 印刷
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media print {
  body { background: #fff; }
  .topnav, .page-head .actions, .btn, .pill, .slider { display: none !important; }
  .card, .kpi, .board-cell { box-shadow: none; border-color: #999; }
  .table.sticky thead th { position: static; }
}
