:root {
  --color-bg: #f4f5f7;
  --color-panel: #ffffff;
  --color-border: #dcdfe4;
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-text: #1f2430;
  --color-muted: #6b7280;
  --color-danger: #dc2626;
  font-family: -apple-system, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--color-bg);
  color: var(--color-text);
}

.screen { height: 100%; }
.hidden { display: none !important; }

/* ログイン画面 */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-form {
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 32px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.login-form h1 {
  font-size: 18px;
  margin: 0 0 8px;
  text-align: center;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--color-muted);
}

.login-form input {
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 14px;
}

.login-form button {
  margin-top: 8px;
  padding: 10px;
  border: none;
  border-radius: 6px;
  background: var(--color-primary);
  color: white;
  font-size: 14px;
  cursor: pointer;
}

.login-form button:hover { background: var(--color-primary-dark); }

.error-text {
  color: var(--color-danger);
  font-size: 13px;
  min-height: 1em;
  margin: 0;
}

/* メイン画面 */
#main-screen {
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--color-panel);
  border-bottom: 1px solid var(--color-border);
}

.app-header h1 { font-size: 16px; margin: 0; }

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--color-muted);
}

.header-right button {
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
}

.app-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

.sidebar {
  width: 320px;
  overflow-y: auto;
  background: var(--color-panel);
  border-right: 1px solid var(--color-border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px;
}

.panel h2 {
  font-size: 13px;
  margin: 0 0 8px;
  color: var(--color-muted);
}

#map {
  flex: 1;
  min-width: 0;
}

.vehicle-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vehicle-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.vehicle-list li:hover { background: var(--color-bg); }
.vehicle-list li.selected { background: #e8edfc; }

.vehicle-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}

.vehicle-name { font-weight: 600; }
.vehicle-time { color: var(--color-muted); font-size: 11px; margin-left: auto; }
.vehicle-offline { color: var(--color-muted); font-size: 11px; }

.vehicle-status-badge {
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  white-space: nowrap;
}

.history-form select,
.history-form input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
}

.history-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--color-muted);
  margin-bottom: 8px;
}

/* LABOR_REPORT_UX_PLAN.md §4: 対象切り替え(車両/ドライバー)。ラジオ+テキストは
   .history-form label の縦積みスタイルを上書きし、横並びのチップ風にする。 */
.history-target-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--color-muted);
  margin-bottom: 8px;
}
.history-target-toggle label {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  margin-bottom: 0;
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
}

.message-tts-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-muted);
  margin-bottom: 8px;
}

.message-log {
  list-style: none;
  margin: 0 0 8px;
  padding: 8px;
  max-height: 55vh;
  min-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--color-bg);
  border-radius: 8px;
}

.message-log li {
  max-width: 75%;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--color-panel);
  align-self: flex-start;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.message-log li.mine {
  align-self: flex-end;
  background: var(--color-primary);
  color: white;
}

.message-log li .meta {
  color: var(--color-muted);
  font-size: 11px;
  display: block;
  margin-top: 4px;
}

.message-log li.mine .meta { color: rgba(255, 255, 255, 0.85); }

.message-log li.empty-hint {
  align-self: center;
  max-width: none;
  background: transparent;
  box-shadow: none;
  color: var(--color-muted);
  padding: 24px 0;
}

.message-form {
  display: flex;
  gap: 6px;
}

.message-form button,
.history-buttons button {
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  background: var(--color-primary);
  color: white;
  font-size: 13px;
  cursor: pointer;
}

#message-ptt-button {
  min-width: 56px;
  min-height: 56px;
  font-size: 22px;
  padding: 0;
}

#message-ptt-button.active {
  background: var(--color-danger, #dc2626);
}

#message-ptt-button:disabled {
  background: var(--color-muted);
  cursor: not-allowed;
}

.message-ptt-error {
  color: #dc2626;
  font-size: 12px;
  margin: 4px 0;
}

.message-ptt-mic-info {
  color: var(--color-muted);
  font-size: 11px;
  margin: 2px 0 4px;
}

.hidden {
  display: none;
}

.tacho-assignment-picker,
.tacho-daily-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.tacho-assignment-picker select {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 12px;
}

.tacho-daily-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-muted);
}

.tacho-daily-row input[type="date"] {
  padding: 5px 6px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 12px;
}

.tacho-assignment-picker button,
.tacho-daily-row button {
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  background: var(--color-primary);
  color: white;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.history-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.speed-chart-panel {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
}

.speed-threshold-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--color-muted);
  margin-bottom: 6px;
}

.speed-threshold-label input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
}

#speed-chart-container svg {
  width: 100%;
  height: auto;
  display: block;
}

.speed-chart-modal-content {
  max-width: 800px;
}

#speed-chart-modal-container svg {
  width: 100%;
  height: auto;
  display: block;
}

.speed-chart-slider {
  width: 100%;
  margin-top: 12px;
}

.history-buttons button:hover,
.message-form button:hover { background: var(--color-primary-dark); }

.status-text {
  font-size: 12px;
  color: var(--color-muted);
  margin: 4px 0 0;
}

/* 入力欄の下に添える補足説明(DELIVERY_SITE_PLAN.md 6.6章: 車高・車長は架装込みの実寸)。
   .status-text が「操作の結果」を出すのに対し、こちらは常時表示の説明文。 */
.hint-text {
  font-size: 12px;
  color: var(--color-muted);
  line-height: 1.5;
  margin: 6px 0 0;
}

/* 整備が必要な状態を知らせる常時表示(例: サイズ区分が未設定の車両が残っている)。
   エラーではないため .hint-text をベースに色だけ変える。 */
.hint-text.warning {
  color: var(--color-danger);
}

/* --- 納品先台帳(DELIVERY_SITE_PLAN.md 5.1章) --- */

.delivery-site-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.delivery-site-toolbar input[type='search'] {
  flex: 1 1 280px;
  min-width: 200px;
}

/* 車両管理・ドライバー管理のCSV行(.csv-import-row)と同じ見た目に揃える。
   台帳のツールバーだけブラウザ既定のボタンのままになっていた。 */
.delivery-site-toolbar button {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  background: var(--color-primary);
  color: white;
  font-size: 12px;
  cursor: pointer;
}

.delivery-site-toolbar button:hover { background: var(--color-primary-dark); }

.delivery-site-toolbar input[type='file'] {
  font-size: 12px;
}

/* 立ち寄り履歴の期間指定 */
.ds-visits-date {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--color-muted);
}

/* 受付時間外に到着した立ち寄り(荷待ちの原因になりやすいので目立たせる) */
.ds-visit-outside {
  color: var(--color-danger);
  font-weight: 600;
}

/* 出力系と取込系のボタンを視覚的に分ける区切り */
.ds-io-separator {
  border-left: 1px solid var(--color-border, #d1d5db);
  align-self: stretch;
  margin: 0 4px;
}

/* 「座標が未確認のみ」フィルタ。チェックボックスとラベルを一体で扱う。 */
.ds-unverified-filter {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--color-muted);
  white-space: nowrap;
}

/* 円が1つも無い納品先(立ち寄り履歴が記録されない)を目立たせる */
.ds-no-geofence {
  color: var(--color-danger);
  font-weight: 600;
}

.delivery-site-pager {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 8px;
  font-size: 13px;
}

/* 項目数が多い(36列)ため、2カラムのグリッドで詰めて表示する。
   .ds-wide を付けた項目だけ1行を使い切る(住所・納品ルールなど長い入力)。 */
.delivery-site-form fieldset {
  border: 1px solid var(--color-border, #d1d5db);
  border-radius: 6px;
  padding: 10px 12px 12px;
  margin: 0 0 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.delivery-site-form legend {
  font-size: 13px;
  font-weight: 600;
  padding: 0 4px;
}

.delivery-site-form label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: var(--color-muted);
  min-width: 0;
}

.delivery-site-form label input,
.delivery-site-form label select,
.delivery-site-form label textarea {
  width: 100%;
  box-sizing: border-box;
}

.delivery-site-form .ds-wide,
.delivery-site-form .ds-geocode-row,
.delivery-site-form .ds-geocode-results,
.delivery-site-form .ds-hours-table,
.delivery-site-form .ds-geofence-list {
  grid-column: 1 / -1;
}

.ds-geocode-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* 住所検索の候補。1件ずつクリックで座標を採用する。 */
.ds-geocode-results {
  border: 1px solid var(--color-border, #d1d5db);
  border-radius: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.ds-geocode-results button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid var(--color-border, #e5e7eb);
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  color: inherit;
}

.ds-geocode-results button:hover {
  background: rgba(37, 99, 235, 0.08);
}

.ds-hours-table {
  border-collapse: collapse;
  font-size: 12px;
}

.ds-hours-table th {
  font-weight: 500;
  color: var(--color-muted);
  padding: 2px 6px;
  text-align: left;
  white-space: nowrap;
}

.ds-hours-table td {
  padding: 2px 4px;
}

.ds-geofence-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
}

.ds-geofence-list li {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid var(--color-border, #e5e7eb);
}

.ds-geofence-list li input.ds-geofence-name {
  flex: 1;
  min-width: 100px;
}

.ds-geofence-list li input[type="number"] {
  width: 70px;
}

.ds-geofence-coords {
  font-size: 11px;
  color: var(--color-muted);
  white-space: nowrap;
}

.ds-form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

@media (max-width: 720px) {
  .delivery-site-form fieldset {
    grid-template-columns: 1fr;
  }
}

#settings-panel label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--color-muted);
}

#settings-panel select {
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
}

#settings-panel h3 {
  font-size: 12px;
  color: var(--color-muted);
  margin: 12px 0 6px;
}

.status-config-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.status-config-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-config-row input[type="text"] {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
}

.status-color-palette {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.status-color-tile {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}

.status-color-tile.selected {
  border-color: var(--color-text, #1f2430);
  box-shadow: 0 0 0 1px white inset;
}

#status-config-save,
#status-config-add {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  background: var(--color-primary);
  color: white;
  font-size: 13px;
  cursor: pointer;
  margin-right: 6px;
}

#status-config-save:hover,
#status-config-add:hover { background: var(--color-primary-dark); }

/* STATUS_KIND_PLAN.md S-3: 枠の並び替え・削除・kind未設定の警告 */
.status-config-order {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.status-order-button {
  width: 22px;
  height: 18px;
  line-height: 1;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-surface, white);
  cursor: pointer;
  font-size: 10px;
}

.status-order-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.status-delete-button {
  padding: 5px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: none;
  color: #b91c1c;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.status-delete-button:hover {
  background: #fee2e2;
}

.status-config-divider {
  font-size: 11px;
  color: var(--color-muted);
  padding: 4px 0;
  border-top: 1px dashed var(--color-border);
  margin-top: 2px;
}

.status-kind-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  margin-bottom: 8px;
}

.address-search-form {
  display: flex;
  gap: 6px;
}

.address-search-form input {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
}

.address-search-form button {
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  background: var(--color-primary);
  color: white;
  font-size: 13px;
  cursor: pointer;
}

.address-search-form button:hover { background: var(--color-primary-dark); }

.address-search-results {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.address-search-results li {
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--color-bg);
  cursor: pointer;
}

.address-search-results li:hover { background: #e8edfc; }

.vehicle-popup-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.vehicle-popup-buttons button {
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  background: var(--color-primary);
  color: white;
  font-size: 12px;
  cursor: pointer;
}

.vehicle-popup-buttons button:hover { background: var(--color-primary-dark); }

.vehicle-popup-buttons button:disabled {
  background: #b9bec7;
  cursor: not-allowed;
}

.car-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.car-icon-manual {
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.55);
  animation: manual-pulse 1.2s ease-in-out infinite;
}

@keyframes manual-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.55); }
  50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0.25); }
}

.manual-badge {
  color: var(--color-danger);
  font-size: 11px;
  font-weight: 600;
}

#vehicle-admin-button,
#driver-admin-button {
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--color-panel);
  border-radius: 10px;
  padding: 20px;
  width: min(920px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  cursor: move;
  touch-action: none;
}

.modal-header h2 { margin: 0; font-size: 16px; }

.modal-header button {
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
}

.vehicle-create-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.vehicle-create-form input {
  flex: 1 1 140px;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
}

.vehicle-create-form input[type="color"] {
  flex: 0 0 44px;
  padding: 0;
  cursor: pointer;
}

.vehicle-create-form select {
  flex: 1 1 120px;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
}

.vehicle-create-form button {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  background: var(--color-primary);
  color: white;
  font-size: 13px;
  cursor: pointer;
}

.vehicle-create-form button:hover { background: var(--color-primary-dark); }

.csv-import-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12px;
}

.csv-import-row input[type="file"] {
  font-size: 12px;
}

.csv-import-row button {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  background: var(--color-primary);
  color: white;
  font-size: 12px;
  cursor: pointer;
}

.csv-import-row button:hover { background: var(--color-primary-dark); }

.import-result {
  font-size: 12px;
  background: var(--color-bg);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
  max-height: 160px;
  overflow-y: auto;
}

.import-result .credential-row {
  font-family: monospace;
}

.import-result .error-row {
  color: var(--color-danger);
}

.vehicle-admin-table-wrap {
  overflow-x: auto;
}

.vehicle-admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.vehicle-admin-table th,
.vehicle-admin-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  white-space: nowrap;
}

.vehicle-admin-table input {
  width: 100%;
  min-width: 70px;
  padding: 4px 6px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 12px;
}

.vehicle-admin-table tr.deleted {
  opacity: 0.5;
}

.vehicle-admin-table .row-actions {
  display: flex;
  gap: 4px;
}

.vehicle-admin-table .row-actions button {
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
  background: var(--color-primary);
  color: white;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}

.vehicle-admin-table .row-actions button:hover { background: var(--color-primary-dark); }

.vehicle-admin-table .row-actions button.danger { background: var(--color-danger); }
.vehicle-admin-table .row-actions button.danger:hover { background: #b91c1c; }

/* OSM_TILE_SERVER_PLAN.md 案C: MapLibre GL JSへ移行(旧.leaflet-control-attributionを置き換え) */
.maplibregl-ctrl-attrib { font-size: 11px; }

/* 道路交通情報リンクボタン(MAP_OVERLAY_PLAN.md 4章)。旧leaflet-barの見た目を踏襲する。
   .maplibregl-ctrl-group自体が白背景・角丸・影を持つため、中身(リンク)だけ整える。 */
.road-traffic-info-control a {
  display: block;
  padding: 0 8px;
  font-size: 12px;
  line-height: 30px;
  color: var(--color-text, #1f2430);
  text-decoration: none;
  white-space: nowrap;
}
.road-traffic-info-control a:hover { background: rgba(0, 0, 0, 0.05); }

/* ズームスライダー(2026-08-20)。NavigationControlの+/-ボタンの直下に置く縦スライダー。
   ボタン幅(29px)に合わせ、writing-mode で縦向きにする。
   ⚠️ 旧来の `transform: rotate(-90deg)` 方式は、親の高さが元の「横幅」のままになり
   レイアウトが崩れるうえ、ドラッグ方向とポインタの対応もずれるため使わない。 */
.map-zoom-slider {
  display: flex;
  justify-content: center;
  padding: 6px 0;
}
.map-zoom-slider input[type='range'] {
  writing-mode: vertical-lr;
  direction: rtl;            /* 上へドラッグ=拡大(地図の直感に合わせる) */
  width: 20px;
  height: 96px;
  margin: 0;
  accent-color: var(--color-primary, #2563eb);
  cursor: pointer;
}
/* 指で掴みやすいよう、タッチ環境では少し広げる */
@media (pointer: coarse) {
  .map-zoom-slider input[type='range'] { width: 28px; height: 120px; }
}

/* 基図・オーバーレイ切替コントロール(MapLibreにはLeafletのL.control.layers相当が無いため自前実装) */
.map-layer-switcher { position: relative; }
.map-layer-switcher-toggle {
  width: 30px;
  height: 30px;
  border: none;
  background: white;
  font-size: 16px;
  cursor: pointer;
  line-height: 30px;
}
.map-layer-switcher-toggle:hover { background: rgba(0, 0, 0, 0.05); }
.map-layer-switcher-panel {
  position: absolute;
  top: 0;
  right: 34px;
  background: white;
  border-radius: 4px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
  padding: 8px 10px;
  font-size: 13px;
  white-space: nowrap;
}
.map-layer-switcher-panel.hidden { display: none; }
.map-layer-switcher-panel hr { margin: 6px 0; border: none; border-top: 1px solid var(--color-border, #ddd); }
.map-layer-switcher-group { display: flex; flex-direction: column; gap: 4px; }
.map-layer-switcher-group label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* ---- 労務管理(P2) ---- */
#labor-admin-button {
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
}

.modal-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 14px;
}

.modal-tab {
  padding: 8px 14px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--color-muted);
  font-size: 13px;
  cursor: pointer;
}

.modal-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}

/* LABOR_REPORT_UX_PLAN.md §5: ダッシュボードの検索欄 */
.labor-dashboard-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.labor-dashboard-filter input {
  flex: 1;
  min-width: 0;
  max-width: 320px;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
}
.labor-dashboard-filter input:focus { outline: none; border-color: var(--color-primary); }

.labor-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.labor-card {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.labor-card.alert { border-color: var(--color-danger); box-shadow: 0 0 0 1px var(--color-danger); }

.labor-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.labor-card-name { font-weight: 600; font-size: 14px; }

.labor-card-state {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.labor-card-state.working { background: #dcfce7; color: #166534; }
.labor-card-state.resting { background: #e5e7eb; color: #374151; }

.labor-warn-flag {
  font-size: 11px;
  color: var(--color-danger);
  font-weight: 600;
}

/* A-1: 24時間タイムライン帯 */
.timeline-mini {
  line-height: 0;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.timeline-large {
  line-height: 0;
  padding: 4px 2px 18px;
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: 10px;
}

.timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  margin-bottom: 4px;
}

.timeline-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--color-muted);
}

.timeline-legend-item i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

/* A-2: 要注意ドライバーのピックアップ */
.labor-attention-section {
  margin: 4px 0 14px;
  padding: 10px 12px;
  border: 1px solid #fde68a;
  border-radius: 10px;
  background: #fffbeb;
}

.labor-attention-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: #92400e;
}

.labor-attention-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.labor-attention-empty {
  margin: 0;
  font-size: 12px;
  color: #166534;
  font-weight: 600;
}

.labor-attention-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.labor-attention-item:hover { background: #fffdf5; border-color: #f59e0b; }

.labor-attention-name { font-size: 13px; font-weight: 600; color: var(--color-text); }

.labor-attention-badges { display: flex; flex-wrap: wrap; gap: 4px; }

.labor-attention-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}

.labor-attention-badge.sev4 { background: #fee2e2; color: #b91c1c; }
.labor-attention-badge.sev3 { background: #ffedd5; color: #c2410c; }
.labor-attention-badge.sev2 { background: #fef3c7; color: #92400e; }

/* A-3/B-1: 月間拘束時間管理表(業界標準の拘束時間管理表に準拠) */
.monthly-summary {
  font-size: 13px;
  color: var(--color-text);
  margin: 4px 0 10px;
}

.monthly-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

/* LABOR_INTERPRETATION_PLAN.md A-1/I-5: 業界標準の様式には無い追加列である旨の注記 */
.monthly-note {
  font-size: 11px;
  color: var(--color-muted);
  margin: 6px 2px 0;
}

/* LABOR_INTERPRETATION_PLAN.md A-6: 所定休日の既定パターン(曜日)チェックボックス群 */
.holiday-dow-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.holiday-dow-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 13px;
}

/* LABOR_INTERPRETATION_PLAN.md A-6・決定事項D-11: 所定休日カレンダーのミニ月表示 */
.holiday-calendar-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 8px 0;
  font-weight: 600;
}

.holiday-calendar-grid {
  overflow-x: auto;
}

.hc-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.hc-table th {
  font-size: 12px;
  color: var(--color-muted);
  padding: 4px 0;
  text-align: center;
}

.hc-table td {
  border: 1px solid var(--color-border);
  height: 52px;
  vertical-align: top;
  padding: 3px;
}

.hc-empty {
  background: transparent;
  border-color: transparent !important;
}

.hc-day {
  cursor: pointer;
}

.hc-day:hover {
  background: var(--color-hover, rgba(0, 0, 0, 0.04));
}

.hc-day-num {
  display: block;
  font-size: 12px;
  color: var(--color-text);
}

.hc-day-label {
  display: block;
  font-size: 10px;
  margin-top: 2px;
}

.hc-off {
  background: #fef3c7;
}
.hc-off .hc-day-label {
  color: #92400e;
}

.hc-legal {
  background: #dbeafe;
}
.hc-legal .hc-day-label {
  color: #1e40af;
}

.hc-workday {
  background: #e5e7eb;
}
.hc-workday .hc-day-label {
  color: #374151;
}

.hc-inherited {
  opacity: 0.55;
}

.monthly-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 12px;
}

.monthly-table th {
  position: sticky;
  top: 0;
  background: #374151;
  color: #fff;
  font-weight: 600;
  padding: 7px 6px;
  text-align: center;
  white-space: nowrap;
}

.monthly-table td {
  padding: 5px 6px;
  border-bottom: 1px solid #eef0f3;
  text-align: center;
  white-space: nowrap;
}

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

.mt-row.mt-notice td { background: #fef3c7; }
.mt-row.mt-over td { background: #fee2e2; }

.monthly-table td.mt-dow-sun { color: #dc2626; font-weight: 600; }
.monthly-table td.mt-dow-sat { color: #2563eb; font-weight: 600; }

.monthly-table td.mt-judge-notice { color: #92400e; font-weight: 700; }
.monthly-table td.mt-judge-over { color: #b91c1c; font-weight: 700; }

/* P-H(C-5): 修正・強制終了の見える化。監査時に「修正の透明性」を示す */
.monthly-table td.mt-correction-corrected { color: #92400e; font-weight: 600; }
.monthly-table td.mt-correction-forceEnded { color: #b91c1c; font-weight: 700; }

/* LABOR_CORRECTION_PLAN.md N-6: 適用除外業務の見える化(告示由来のアラート対象外である旨) */
.monthly-table td.mt-exempt { color: #6d28d9; font-weight: 600; }

/* LABOR_REPORT_UX_PLAN.md §7.2: 日クリックでの日報遷移・「戻る」時のハイライト */
.mt-date-link {
  border: none;
  background: none;
  color: var(--color-primary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.mt-date-link:hover { color: var(--color-primary-dark); }
.mt-row.mt-row-highlight td {
  background: #dbeafe !important;
  transition: background 0.3s ease;
}

.report-back-bar {
  margin: 0 0 10px;
}
.report-back-bar .link-button {
  font-weight: 600;
}

/* B-3: 残業・深夜集計の注記 */
.labor-settings-note {
  font-size: 12px;
  color: #92400e;
  background: #fef3c7;
  padding: 6px 10px;
  border-radius: 6px;
  margin: 0 0 10px;
}

/* A-4: 年間拘束時間推移ビューの棒グラフ */
#annual-chart-container svg { width: 100%; height: auto; }
.an-bar-ok { fill: #2563eb; }
.an-bar-notice { fill: #d97706; }
.an-bar-over { fill: #dc2626; }
.an-bar-future { fill: #d1d5db; }
.an-bar-label { font-size: 9px; fill: #4b5563; }
.an-limit-line { stroke: #b91c1c; stroke-width: 1; stroke-dasharray: 4,3; }

/* 乗務中カードの強制終了UI(押し忘れ対応) */
.labor-force-end { display: flex; flex-direction: column; gap: 6px; }

.labor-force-end-toggle {
  align-self: flex-start;
  font-size: 11px;
  padding: 3px 10px;
  border: 1px solid var(--color-danger);
  border-radius: 6px;
  background: #fff;
  color: var(--color-danger);
  cursor: pointer;
}

.labor-force-end-toggle:hover { background: #fef2f2; }

.labor-force-end-form {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.labor-force-end-form input[type='datetime-local'] {
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}

.labor-force-end-exec {
  font-size: 11px;
  padding: 4px 10px;
  border: none;
  border-radius: 6px;
  background: var(--color-danger);
  color: #fff;
  cursor: pointer;
}

.labor-force-end-cancel {
  font-size: 11px;
  padding: 4px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  cursor: pointer;
}

.labor-metric { display: flex; flex-direction: column; gap: 3px; }

.labor-metric-head {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--color-muted);
}

.labor-metric-head b { color: var(--color-text); font-weight: 600; }

.labor-bar {
  height: 8px;
  border-radius: 4px;
  background: #eef0f3;
  overflow: hidden;
}

.labor-bar-fill { height: 100%; border-radius: 4px; transition: width 0.3s; }
.labor-bar-fill.ok { background: #22c55e; }
.labor-bar-fill.warn { background: #eab308; }
.labor-bar-fill.danger { background: var(--color-danger); }

.labor-card-foot {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--color-muted);
  border-top: 1px solid var(--color-border);
  padding-top: 6px;
}

.labor-rest-short { color: var(--color-danger); font-weight: 600; }

/* P-B: 運転時間(N週平均・2日平均)セクション。
   拘束時間とは別系統の規制なので、区切り線と見出しで独立したまとまりに見せる。
   情報量は多めに出し、状態は色で優先順位を付ける(COMPLIANCE_AND_HARDENING_PLAN.md Q-13)。 */
.driving-section {
  border-top: 1px dashed var(--color-border);
  margin-top: 8px;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.driving-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-muted);
  letter-spacing: 0.06em;
}

.labor-bar-fill.driving-ok { background: #22c55e; }
.labor-bar-fill.driving-notice { background: #eab308; }
.labor-bar-fill.driving-warning { background: #f97316; }
.labor-bar-fill.driving-violation { background: var(--color-danger); }

.driving-sub { font-size: 11px; color: var(--color-muted); }
.driving-sub b { color: var(--color-text); }
.driving-sub-dim { opacity: 0.75; }

.driving-day2 { display: flex; flex-direction: column; gap: 3px; }
.driving-day2-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--color-muted);
}

.driving-chip {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  color: #fff;
}
.driving-chip-ok { background: #22c55e; }
.driving-chip-notice { background: #eab308; }
.driving-chip-warning { background: #f97316; }
.driving-chip-violation { background: var(--color-danger); }

/* P-L: ログイン画面の法的リンク(位置情報の取扱い)。目立ちすぎず、必ず見える位置に置く */
.login-legal-links { margin-top: 6px; text-align: center; font-size: 11px; }
.login-legal-links a { color: var(--color-muted); }
.login-legal-links a:hover { color: #2563eb; }

/* P-J: 設定ヘルプ。各項目のラベル横に ⓘ を出し、クリックで説明を開く。
   文言は src/help/laborHelp.js が唯一のソース(CSSはここ、文言はあちら)。 */
.labor-settings-form label { position: relative; }

.help-icon {
  align-self: flex-start;
  border: none;
  background: none;
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1;
  padding: 2px 4px;
  margin-left: 4px;
  cursor: pointer;
  border-radius: 3px;
}
.help-icon:hover { color: #2563eb; background: #eff6ff; }
.help-icon.open { color: #2563eb; background: #dbeafe; }

.help-popover {
  position: absolute;
  z-index: 40;
  top: 100%;
  left: 0;
  width: min(360px, 90vw);
  margin-top: 4px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.16);
  font-weight: 400;
}

.help-popover-title { font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.help-popover p { margin: 0 0 6px; font-size: 11.5px; line-height: 1.6; }
.help-popover p:last-child { margin-bottom: 0; }
.help-popover-summary { color: var(--color-text); }
.help-popover-detail { color: var(--color-muted); }
.help-popover-warning {
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 6px 8px;
}
.help-popover-ref { color: var(--color-muted); font-size: 10.5px; }

/* LABOR_INTERPRETATION_PLAN.md §4: 判定根拠ドキュメント。文言は src/help/laborBasis.js が
   唯一のソース。confidence(confirmed/inferred/pending)で色分けし、確定していない解釈を
   利用者に隠さない。 */
.labor-basis-accordion {
  margin-top: 16px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0 12px;
}
.labor-basis-accordion > summary {
  cursor: pointer;
  padding: 10px 0;
  font-size: 13px;
  font-weight: 700;
  list-style: none;
}
.labor-basis-accordion > summary::-webkit-details-marker { display: none; }
.labor-basis-accordion > summary::before { content: '▶ '; color: var(--color-muted); }
.labor-basis-accordion[open] > summary::before { content: '▼ '; }
.labor-basis-list { padding: 4px 0 12px; }

.labor-basis-item {
  border-top: 1px solid var(--color-border);
  padding: 10px 0;
}
.labor-basis-item:first-child { border-top: none; }
.labor-basis-item-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.labor-basis-title { font-size: 12.5px; font-weight: 700; }
.labor-basis-ref { font-size: 10.5px; color: var(--color-muted); }
.labor-basis-item dl { margin: 6px 0 0; font-size: 11.5px; line-height: 1.6; }
.labor-basis-item dt { font-weight: 600; color: var(--color-muted); margin-top: 4px; }
.labor-basis-item dd { margin: 0 0 0 0; color: var(--color-text); }
.labor-basis-limitation {
  margin-top: 4px;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 11px;
}

.labor-basis-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
}
.labor-basis-badge-confirmed { background: #dcfce7; color: #15803d; }
.labor-basis-badge-inferred { background: #fef3c7; color: #b45309; }
.labor-basis-badge-pending { background: #fee2e2; color: #b91c1c; }

/* LABOR_INTERPRETATION_PLAN.md §3: 営業所・ドライバー別の労務設定の上書き */
.labor-override-form { display: flex; flex-direction: column; gap: 10px; }
.labor-override-field {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(180px, 1.4fr) minmax(90px, 0.7fr);
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--color-border);
}
.labor-override-field-label { font-size: 12.5px; font-weight: 600; }
.labor-override-inherit {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--color-muted);
}
.labor-override-field .lo-value:disabled { background: var(--color-bg-muted, #f1f5f9); color: var(--color-muted); }
.labor-override-warnings {
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 12px;
  margin-bottom: 10px;
}
.labor-override-warnings p { margin: 0 0 4px; }
.labor-override-warnings p:last-child { margin-bottom: 0; }

/* 旧設定(後方互換のため残しているもの)。現行の設定と見分けが付くよう控えめに見せる */
.labor-settings-legacy { opacity: 0.7; }
.labor-settings-legacy small { display: block; font-size: 10px; color: var(--color-muted); }

/* 月間管理表: N週平均のブロック境界。累計の起算がどこかを一目で分かるようにする */
.monthly-table tr.mt-week-block-start > td {
  border-top: 2px solid #64748b;
}

/* 「このあと何分まで運転できるか」。片側超過のときに最も行動に直結する情報なので目立たせる */
.driving-remain {
  font-size: 11px;
  font-weight: 600;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 4px 6px;
}

/* 2026-08-08: 労務設定タブのサブタブ(カテゴリ分け)。外側の.modal-tabsとは別の見た目にして
   「モーダルのタブ」と「その中のさらに細かい分類」を視覚的に区別する(ピル型・小さめ)。 */
.labor-settings-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.labor-settings-subtab {
  padding: 5px 12px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-bg);
  color: var(--color-muted);
  font-size: 12px;
  cursor: pointer;
}

.labor-settings-subtab:hover { color: var(--color-primary); border-color: var(--color-primary); }

.labor-settings-subtab.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  font-weight: 600;
}

.labor-settings-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  /* 一部の項目だけ<small>のヘルプ文言が付いて縦に長くなるため、align-items: end だと
     同じ行の短い項目が下寄せで押し下げられ、入力欄の高さが行ごとにバラバラになる
     (「階段状にずれる」の原因)。start にして全項目の先頭(ラベル)を揃え、
     <small>は下に伸びるだけで他の項目に影響しないようにする。 */
  align-items: start;
}

.labor-settings-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--color-muted);
}

.labor-settings-form select,
.labor-settings-form input {
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
}

.labor-settings-form button[type='submit'] {
  grid-column: 1 / -1;
  justify-self: start;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: var(--color-primary);
  color: white;
  font-size: 13px;
  cursor: pointer;
}

.labor-settings-form button[type='submit']:hover { background: var(--color-primary-dark); }

.labor-settings-section-title {
  grid-column: 1 / -1;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

.labor-settings-form label.labor-settings-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text);
}

.labor-settings-form input[type='checkbox'] {
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  flex-shrink: 0;
}

.labor-corrections-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin-bottom: 8px;
}

.labor-corrections-filter label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--color-muted);
}

.labor-corrections-filter select,
.labor-corrections-filter input {
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
}

.labor-corrections-filter button {
  padding: 7px 14px;
  border: none;
  border-radius: 6px;
  background: var(--color-primary);
  color: white;
  font-size: 13px;
  cursor: pointer;
}

.labor-corrections-filter button:hover { background: var(--color-primary-dark); }

#labor-corrections-tbody input[type="datetime-local"] {
  min-width: 180px;
}

.correction-badge {
  font-size: 10px;
  color: var(--color-danger);
  font-weight: 600;
}

/* 勤務記録の修正: 理由入力+ステータス修正の詳細行(既定は非表示) */
#labor-corrections-tbody tr.correction-details.hidden { display: none; }
#labor-corrections-tbody tr.correction-details td {
  background: var(--color-bg);
  padding: 10px 12px;
  border-top: 1px dashed var(--color-border);
}

.correction-reason-label {
  display: block;
  font-size: 12px;
  color: var(--color-muted);
  margin-bottom: 6px;
}

.correction-reason-input {
  display: block;
  width: 100%;
  max-width: 520px;
  margin-top: 4px;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
}

.correction-status-edits {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.correction-status-edit-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.row-actions .link-button {
  margin-right: 8px;
  font-size: 12px;
}

/* ADOMS #22/#23/#47・LABOR_CORRECTION_PLAN.md N-6: 事由登録パネル(打刻修正の理由とは別枠) */
.assignment-reasons-list-wrap { margin-bottom: 8px; }

.assignment-reasons-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.assignment-reasons-list li {
  font-size: 12px;
  padding: 4px 6px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
}

.assignment-reasons-form {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.assignment-reasons-form select,
.assignment-reasons-form input[type='datetime-local'],
.assignment-reasons-form input[type='number'] {
  padding: 5px 6px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
}

.assignment-reasons-conditional {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--color-muted);
}

.assignment-reasons-conditional.hidden { display: none; }

.assignment-reasons-conditional input,
.assignment-reasons-conditional select {
  padding: 5px 6px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
}

/* P-H: 勤務記録の修正のビジュアルタイムライン(COMPLIANCE_AND_HARDENING_PLAN.md §23)。
   1日を選んで大きく表示し、「表示幅」で1画面に見せる時間数(ズーム)を変えられる。
   24時間より狭くすると内側のキャンバスが横に伸びるため、外側の枠を横スクロールさせる。 */
.corrections-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
}

.timeline-day-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.timeline-day-tab {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: #fff;
  color: var(--color-text);
  cursor: pointer;
}

.timeline-day-tab:hover { background: #f3f4f6; }

.timeline-day-tab.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
  font-weight: 600;
}

.timeline-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--color-muted);
}

.timeline-toolbar select {
  margin-left: 4px;
  padding: 3px 6px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 12px;
}

.timeline-toolbar-hint { color: var(--color-muted); }

.timeline-scroll-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 8px;
}

.timeline-canvas {
  position: relative;
  min-width: 100%;
}

.timeline-ruler {
  position: relative;
  height: 16px;
  margin-bottom: 4px;
}

.timeline-ruler-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--color-muted);
  white-space: nowrap;
}

.timeline-track {
  position: relative;
  height: 56px;
  border-radius: 10px;
  overflow: hidden;
  background: #e5e7eb;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.timeline-block {
  position: absolute;
  top: 0;
  height: 100%;
}

.timeline-block-rest { background: #d1d5db; }

.timeline-block-pending {
  opacity: 0.75;
  outline: 2px dashed rgba(0, 0, 0, 0.4);
  outline-offset: -2px;
  cursor: pointer;
}

.timeline-anchor {
  position: absolute;
  top: -5px;
  width: 10px;
  margin-left: -5px;
  height: calc(100% + 10px);
  background: rgba(17, 24, 39, 0.6);
  border-radius: 4px;
  cursor: ew-resize;
  touch-action: none;
  z-index: 2;
}

.timeline-anchor:hover { background: rgba(17, 24, 39, 0.85); }

.timeline-anchor-static {
  cursor: default;
  background: rgba(17, 24, 39, 0.3);
}

/* ドラッグ中、アンカーの真上に現在時刻を追従表示するツールチップ(position:fixed、body直下) */
.timeline-drag-tooltip {
  position: fixed;
  transform: translateX(-50%);
  background: rgba(17, 24, 39, 0.9);
  color: white;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  pointer-events: none;
  z-index: 3000;
  white-space: nowrap;
}

/* LABOR_REPORT_UX_PLAN.md §8: 日報タイムラインエディタ。
   .timeline-scroll-wrap/.timeline-canvas/.timeline-ruler(-tick)/.timeline-track/.timeline-block/
   .timeline-drag-tooltip は labor/timeline.js(勤務記録の修正タブ)と共用する(見た目の言語を揃える)。
   区間の掴む・選ぶ・分割/削除・未保存の可視化まわりだけ .re- プレフィックスの専用クラスにする。 */
.report-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fffbeb;
}

.report-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.report-editor-mode-badge {
  font-weight: 700;
  color: #92400e;
}

.report-editor-dirty-count {
  color: var(--color-muted);
}

.report-editor-zoom select {
  margin-left: 4px;
  padding: 3px 6px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 12px;
}

.report-editor-toolbar-spacer {
  flex: 1;
}

.report-editor-toolbar button {
  padding: 5px 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}

.report-editor-toolbar button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.report-editor-toolbar button.primary-button {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
  font-weight: 600;
}

/* 区間ブロック(閲覧用.timeline-blockと違い、クリック選択・未保存の可視化を持つ) */
.re-segment {
  position: absolute;
  top: 0;
  height: 100%;
  cursor: pointer;
  box-sizing: border-box;
}

/* 選択中の区間(2026-08-26改善: 実機フィードバックで「もっとわかりやすく」との指摘)。
   区間の色は会社ごとのステータス色で任意なので、単色の枠だと同系色の区間に埋もれることがある。
   白→黒の二重リング+影にすることで、明るい色・暗い色どちらの区間でも視認できるようにする。
   outlineではなくbox-shadowを使うのは、.re-dirty(斜線ハッチングの未保存表示)がoutlineを
   使っており、選択かつ未保存(併発しうる)でも両方のスタイルが競合せず同時に効くようにするため。 */
.re-segment.re-selected {
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 4px #111827,
    0 2px 6px rgba(0, 0, 0, 0.45);
  z-index: 1; /* .re-handle(z-index:2)より下にして、境界のハンドルが選択中の区間に隠れないようにする */
}

/* 未保存の変更がある区間: 斜線ハッチング+太枠(§8.3「未保存の可視化」) */
.re-segment.re-dirty {
  outline: 2px dashed #92400e;
  outline-offset: -2px;
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.35) 0,
    rgba(255, 255, 255, 0.35) 4px,
    transparent 4px,
    transparent 8px
  );
}

/* 区間どうしの継ぎ目のハンドル(║、細め)。乗務開始・終了(.re-handle-boundary)は太く別色にする */
.re-handle {
  position: absolute;
  top: -3px;
  width: 8px;
  margin-left: -4px;
  height: calc(100% + 6px);
  background: rgba(17, 24, 39, 0.55);
  border-radius: 3px;
  cursor: ew-resize;
  touch-action: none;
  z-index: 2;
}

.re-handle:hover { background: rgba(17, 24, 39, 0.85); }

.re-handle-boundary {
  width: 12px;
  margin-left: -6px;
  background: #1d4ed8;
}

.re-handle-boundary:hover { background: #1e3a8a; }

.re-handle-static {
  cursor: default;
  background: rgba(17, 24, 39, 0.25);
}

.report-editor-inspector {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
}

.report-editor-inspector-title {
  font-weight: 600;
}

.report-editor-inspector-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.report-editor-inspector-row select,
.report-editor-inspector-row input[type='datetime-local'] {
  padding: 4px 6px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
}

.report-editor-inspector-actions button {
  padding: 5px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
}

.report-editor-inspector-actions button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.report-editor-hint {
  font-size: 12px;
  color: var(--color-muted);
}

.labor-alert-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--color-danger);
  color: white;
  font-size: 10px;
  font-weight: 600;
}

.labor-alerts-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 60vh;
  overflow-y: auto;
}

.labor-alerts-list li {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--color-bg);
  font-size: 13px;
  border-left: 3px solid var(--color-muted);
}

.labor-alerts-list li.warning { border-left-color: var(--color-danger); }
.labor-alerts-list li.notice { border-left-color: #eab308; }

/* 本文+日時の行。アクションボタン(下記)は別行にして、幅の狭い右サイドバーでも
   本文とボタンが幅を奪い合ってCJK文字が1文字ずつ縦折り返しになる崩れを防ぐ。 */
.labor-alerts-list .alert-row-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.labor-alerts-list .alert-meta {
  color: var(--color-muted);
  font-size: 11px;
  white-space: nowrap;
}

.labor-alerts-list .alert-body {
  flex: 1;
  min-width: 0;
  /* プラン変更通知(planNotify.js)は改行入りの複数行本文を送るため、既存の単一行アラートの
     見た目を変えずに改行だけ効かせる(pre-lineは連続空白は詰めるが\nは改行として扱う) */
  white-space: pre-line;
}

/* LABOR_INTERPRETATION_PLAN.md §6.2(決定事項D-14): 取消済みアラート(「取消済みも表示」時のみ表示) */
.labor-alerts-list li.alert-retracted {
  opacity: 0.6;
}
.labor-alerts-list li.alert-retracted .alert-body {
  text-decoration: line-through;
}
.labor-alerts-list .alert-retracted-note {
  font-size: 11px;
  color: var(--color-muted);
  margin-top: 2px;
}

.alert-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.alert-action-button {
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid var(--color-primary);
  border-radius: 6px;
  background: #fff;
  color: var(--color-primary);
  cursor: pointer;
}

.alert-action-button:hover { background: #eff6ff; }

.labor-card-highlight { animation: labor-card-flash 2.5s ease-out; }

@keyframes labor-card-flash {
  0% { box-shadow: 0 0 0 3px var(--color-primary); }
  100% { box-shadow: none; }
}

/* ステータス設定の労務フラグ(除外/停止検知) */
.status-config-flags {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--color-muted);
  margin: 0 0 4px 2px;
}

.status-config-flags label {
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
}

/* 日報(P5) */
.report-content h3 {
  font-size: 13px;
  color: var(--color-muted);
  margin: 16px 0 6px;
}

.report-content table {
  margin-bottom: 4px;
}

.report-actions {
  display: flex;
  gap: 14px;
  margin-bottom: 8px;
}

.link-button {
  color: var(--color-primary);
  font-size: 13px;
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.link-button:hover { text-decoration: underline; }

.version-footer {
  text-align: center;
  color: #9CA3AF;
  font-size: 11px;
  padding: 12px 0 24px;
}

/* 営業所グルーピング(2026-07-14 アカウントレベル分け対応) */

.code-help-details {
  margin: 6px 0 0;
  font-size: 12px;
}

.code-help-details summary {
  cursor: pointer;
  color: var(--color-primary);
}

.code-help-title {
  margin: 10px 0 4px;
  font-weight: bold;
}

.code-help-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}

.code-help-table th,
.code-help-table td {
  border: 1px solid var(--color-border);
  padding: 3px 6px;
  text-align: left;
  vertical-align: top;
}

.code-help-table th {
  background: var(--color-bg);
  white-space: nowrap;
}

.code-help-table td:first-child {
  font-family: monospace;
  white-space: nowrap;
}

.office-filter-details {
  margin-bottom: 8px;
  font-size: 12px;
}

.office-filter-details summary {
  cursor: pointer;
  color: var(--color-primary);
}

.office-filter-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 6px 0 2px;
}

.office-filter-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: normal;
  cursor: pointer;
}

.office-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
}

.office-table th,
.office-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
}

.office-table td.actions {
  white-space: nowrap;
}

.office-name-input {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 13px;
}

.multi-login-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: #fef3c7;
  color: #92400e;
  font-size: 13px;
  border-bottom: 1px solid #fde68a;
}

.multi-login-banner button {
  padding: 4px 10px;
  border: none;
  border-radius: 6px;
  background: #92400e;
  color: white;
  font-size: 12px;
  cursor: pointer;
}

/* A-5: 管理側労務ウォッチ */
.labor-watch-header-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 10px;
  border: 1px solid var(--color-border, #d1d5db);
  background: none;
  font-size: 12px;
  cursor: pointer;
}
.labor-watch-count-notice { color: #92400e; font-weight: 700; }
.labor-watch-count-danger { color: #b91c1c; font-weight: 700; }

/* FEATURE_INVENTORY.md 5.2章: トライアル中のヘッダーバッジ */
.trial-header-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 10px;
  border: 1px solid #f59e0b;
  background: #fffbeb;
  color: #92400e;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* FEATURE_INVENTORY.md 5.2章: 制限機能はグレーアウト+クリックで案内表示に統一する */
.plan-locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.vehicle-watch-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  white-space: nowrap;
}
.vehicle-watch-badge.labor-watch-row-notice,
li.labor-watch-row-notice { background: #fef3c7; }
.vehicle-watch-badge.labor-watch-row-notice { color: #92400e; }
.vehicle-watch-badge.labor-watch-row-danger,
li.labor-watch-row-danger { background: #fee2e2; }
.vehicle-watch-badge.labor-watch-row-danger { color: #b91c1c; }

@keyframes labor-watch-halo-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.labor-watch-halo-pulse { animation: labor-watch-halo-pulse 1.2s ease-in-out infinite; }

.labor-watch-toast-container {
  position: fixed;
  top: 56px;
  right: 12px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.labor-watch-toast {
  background: #b91c1c;
  color: white;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  max-width: 320px;
}

/* ---- ヘッダー左側(ハンバーガー+タイトル)・アイコンボタン共通 ---- */
.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.icon-btn:hover { background: var(--color-bg); }

#mobile-sidebar-toggle { display: none; }

/* ---- 左サイドバー: 開閉(アイコンレールに収束) ---- */
.app-body {
  position: relative; /* モバイル時のオーバーレイ配置の基準 */
}

.sidebar {
  width: 320px;
  min-width: 320px;
  overflow: hidden;
  background: var(--color-panel);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: 0;
  gap: 0;
  transition: width 0.2s ease, min-width 0.2s ease;
}

.sidebar-header {
  display: flex;
  justify-content: flex-end;
  padding: 8px 8px 0;
  flex: none;
}

.sidebar-toggle-btn {
  width: 26px;
  height: 26px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  flex: none;
}

.sidebar-toggle-btn:hover { background: var(--color-bg); }

.sidebar-rail {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 4px 0 12px;
  flex: none;
}

.sidebar-rail-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 15px;
}

.sidebar-rail-btn:hover { background: var(--color-bg); }

.sidebar-panels {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 12px 12px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.sidebar.collapsed {
  width: 48px;
  min-width: 48px;
}

.sidebar.collapsed .sidebar-header { justify-content: center; }
.sidebar.collapsed .sidebar-panels { display: none; }
.sidebar.collapsed .sidebar-rail { display: flex; }

/* パネルのアコーディオン化(旧.panel相当の見た目をdetails/summaryへ) */
.panel-details {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  flex: none;
}

.panel-details > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-panel);
}

.panel-details > summary::-webkit-details-marker { display: none; }

.panel-details > summary::after {
  content: '▸';
  color: var(--color-muted);
  transition: transform 0.15s;
}

.panel-details[open] > summary::after { transform: rotate(90deg); }

.panel-details .panel-body {
  padding: 0 12px 12px;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 890;
}

.sidebar-backdrop.active { display: block; }

/* ---- レスポンシブ: 900px未満はサイドバーをオーバーレイドロワー化 ---- */
@media (max-width: 900px) {
  #mobile-sidebar-toggle { display: inline-flex; }

  .sidebar-header { display: none; } /* デスクトップの収束トグルは使わない */

  .sidebar,
  .sidebar.collapsed {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 900;
    width: 85vw;
    max-width: 340px;
    min-width: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.2);
  }

  .sidebar.mobile-open { transform: translateX(0); }

  .sidebar-rail { display: none !important; }
  .sidebar.collapsed .sidebar-panels,
  .sidebar-panels { display: flex; }
}

/* ---- このアプリについて ---- */
.about-modal-content { width: min(420px, 92vw); }

.about-app-name {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 4px;
}

.about-body hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 12px 0;
}

.about-contact {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 13px;
}

.about-contact dt { color: var(--color-muted); }
.about-contact dd { margin: 0; }
.about-contact a { color: var(--color-primary); text-decoration: none; }
.about-contact a:hover { text-decoration: underline; }

.about-attribution {
  font-size: 11px;
  color: var(--color-muted);
  line-height: 1.6;
  margin: 0;
}

.login-about-link {
  margin-top: 4px;
  align-self: center;
}

/* ---- 右サイドバー: メッセージ/アラート統合(UI_REDESIGN_PLAN.md 6章) ---- */

.right-sidebar {
  width: 360px;
  min-width: 360px;
  border-right: none;
  border-left: 1px solid var(--color-border);
}

.right-sidebar .sidebar-header { justify-content: flex-start; }
.right-sidebar.collapsed .sidebar-header { justify-content: center; }
.right-sidebar.collapsed { width: 56px; min-width: 56px; }
.right-sidebar.collapsed .right-sidebar-panels { display: none; }
.right-sidebar.collapsed .right-rail { display: flex; }

.right-rail { position: relative; }

.rail-badge {
  position: absolute;
  top: -4px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 8px;
  background: var(--color-danger);
  color: white;
  font-size: 9px;
  line-height: 16px;
  text-align: center;
}

.right-sidebar-panels {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 0;
}

.right-tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  flex: none;
}

.right-tab {
  flex: 1;
  padding: 10px 8px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--color-muted);
  font-size: 13px;
  cursor: pointer;
}

.right-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}

.right-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* 新規送信・チャットメニュー共通のドロップダウン */
.dropdown-wrap { position: relative; }

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  min-width: 180px;
  z-index: 20;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dropdown-item {
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: none;
  text-align: left;
  font-size: 13px;
  cursor: pointer;
  color: var(--color-text);
}

.dropdown-item:hover { background: var(--color-bg); }
.dropdown-menu .message-tts-toggle { padding: 6px 10px; margin: 0; }

/* 会話一覧(ビューA) */
.conversation-list-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 10px;
}

.conversation-list-toolbar {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex: none;
}

#conversation-search {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
}

.conversation-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.conversation-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  border-radius: 8px;
  cursor: pointer;
}

.conversation-list li:hover { background: var(--color-bg); }
.conversation-list li.broadcast-row { border-bottom: 1px solid var(--color-border); margin-bottom: 4px; padding-bottom: 10px; }

.conversation-list .conv-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex: none;
}

.conversation-list .conv-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conversation-list .conv-name {
  font-size: 13px;
  font-weight: 600;
}

.conversation-list .conv-preview {
  font-size: 12px;
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-list .conv-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex: none;
}

.conversation-list .conv-time {
  font-size: 11px;
  color: var(--color-muted);
}

.conversation-list .conv-unread-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #22c55e;
  color: white;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

/* チャット(ビューB) */
.chat-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 10px;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex: none;
}

.chat-peer-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-view .message-log {
  flex: 1;
  min-height: 0;
  max-height: none;
}

.date-separator {
  align-self: center;
  font-size: 11px;
  color: var(--color-muted);
  margin: 4px 0;
}

.message-log li .broadcast-tag {
  display: inline-block;
  font-size: 10px;
  color: var(--color-primary);
  margin-bottom: 2px;
}

.message-log li.mine .broadcast-tag { color: rgba(255, 255, 255, 0.85); }

.read-receipt {
  display: block;
  font-size: 10px;
  color: var(--color-muted);
  margin-top: 2px;
  text-align: right;
}

.read-receipt.clickable { cursor: pointer; text-decoration: underline; }

.chat-view .message-form textarea {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  max-height: 80px;
  line-height: 1.4;
}

/* アラートフィード(ビューC) */
#right-panel-alerts {
  padding: 10px;
  overflow-y: auto;
}

#right-panel-alerts .labor-alerts-list li { cursor: pointer; }
#right-panel-alerts .labor-alerts-list li.unread { box-shadow: 0 0 0 1px var(--color-primary) inset; }

/* 既読者/未読者一覧モーダル */
.read-status-modal-content { width: min(480px, 92vw); }

.read-status-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.read-status-columns h3 {
  font-size: 12px;
  color: var(--color-muted);
  margin: 0 0 6px;
}

.read-status-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  max-height: 40vh;
  overflow-y: auto;
}

.read-status-list .read-status-time {
  display: block;
  font-size: 11px;
  color: var(--color-muted);
}

/* ---- レスポンシブ: 右サイドバーもモバイルではオーバーレイドロワー ---- */
@media (max-width: 900px) {
  #right-sidebar-toggle { display: none; }

  .right-sidebar,
  .right-sidebar.collapsed {
    position: fixed;
    top: 0;
    right: 0;
    left: auto;
    height: 100%;
    z-index: 900;
    width: 100vw;
    max-width: none;
    min-width: 0;
    transform: translateX(100%);
    transition: transform 0.2s ease;
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.2);
  }

  .right-sidebar.mobile-open { transform: translateX(0); }
  .right-rail { display: none !important; }
  .right-sidebar.collapsed .right-sidebar-panels,
  .right-sidebar-panels { display: flex; }

  #mobile-right-sidebar-toggle { display: inline-flex; }
}

#mobile-right-sidebar-toggle { display: none; position: relative; }

/* LABOR_UX_IMPROVEMENT_PLAN.md B-4: 帳票の共通ブランディング(会社ロゴ・押印欄)のプレビュー */
.report-branding-logo-preview-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
}

.report-branding-logo-preview-wrap img {
  max-width: 160px;
  max-height: 60px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: #fff;
  padding: 4px;
}

/* DRIVING_DAILY_REPORT_PLAN.md D-5: 押印欄の欄名(最大4個) */
.report-branding-stamp-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
  font-size: 13px;
}

.report-branding-stamp-labels span {
  flex: 1 0 100%;
  color: var(--color-text-muted, #6b7280);
}

.report-branding-stamp-labels input {
  flex: 1 1 120px;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
}

/* ============================================================
   LABOR_SETUP_WIZARD_PLAN.md §4(第2弾): 労務条件初期設定ウィザード
   ============================================================ */

/* --- 労務設定タブ最上部の状態バー(§7.1) --- */
.labor-setup-statusbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 12.5px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
}
.labor-setup-statusbar.is-completed {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}
.labor-setup-statusbar.is-warning {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}
.labor-setup-statusbar-icon { font-size: 15px; }
.labor-setup-statusbar-text { flex: 1; line-height: 1.5; }
.labor-setup-statusbar-actions { display: flex; gap: 10px; flex-shrink: 0; }
.labor-setup-link-btn {
  border: none;
  background: none;
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
}
.labor-setup-link-btn:hover { text-decoration: underline; }

/* --- ウィザード本体のモーダル --- */
.labor-setup-modal-content {
  width: min(760px, 94vw);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.labor-setup-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 16px;
}
.labor-setup-progress-step {
  flex: 1 1 auto;
  min-width: 64px;
  text-align: center;
  padding: 6px 4px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--color-muted);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  cursor: default;
}
.labor-setup-progress-step.is-reachable { cursor: pointer; }
.labor-setup-progress-step.is-current {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  font-weight: 700;
}
.labor-setup-progress-step.is-done {
  border-color: #86efac;
  background: #f0fdf4;
  color: #15803d;
}
.labor-setup-progress-step-num { display: block; font-weight: 700; font-size: 12px; }

.labor-setup-step-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 4px;
}

.labor-setup-step-title { font-size: 16px; font-weight: 700; margin: 0 0 4px; }
.labor-setup-step-desc { font-size: 12.5px; color: var(--color-muted); margin: 0 0 16px; line-height: 1.6; }

.labor-setup-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}
.labor-setup-nav-status { flex: 1; font-size: 12px; color: var(--color-muted); text-align: center; }
.labor-setup-nav-btn {
  padding: 8px 18px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}
.labor-setup-nav-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.labor-setup-nav-btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  font-weight: 600;
}
.labor-setup-nav-btn-primary:hover:not(:disabled) { background: var(--color-primary-dark); }

/* --- 項目カード(§4.4) --- */
.labor-setup-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.labor-setup-card {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  /* LABOR_REPORT_UX_PLAN.md §9: グリッドセルはminmax(280px,1fr)で幅が決まるが、
     子のselect/inputが内容幅(最長optionの幅)を持つとgridアイテムの既定min-width:autoに
     阻まれて縮まず、カードからはみ出していた(2026-08-25発見のレイアウト崩れ)。 */
  min-width: 0;
}
.labor-setup-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.labor-setup-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  white-space: nowrap;
}
.labor-setup-badge-legal { background: #eef2ff; color: #4338ca; }
.labor-setup-badge-company { background: #eff6ff; color: #1d4ed8; }
.labor-setup-badge-interpretation { background: #fefce8; color: #854d0e; }
.labor-setup-badge-notification { background: #f1f5f9; color: #475569; }
.labor-setup-card-label { font-size: 13px; font-weight: 600; flex: 1; }
.labor-setup-card-help {
  border: none;
  background: none;
  color: var(--color-muted);
  cursor: pointer;
  font-size: 13px;
}
.labor-setup-card-body { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.labor-setup-card-body select,
.labor-setup-card-body input[type='number'],
.labor-setup-card-body input[type='date'],
.labor-setup-card-body input[type='text'] {
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
  /* LABOR_REPORT_UX_PLAN.md §9: selectは最長optionの内容幅を持つため、幅指定が無いと
     カード幅(280px〜)を超えてはみ出す。100%+min-width:0で確実にカード内へ収める。 */
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.labor-setup-card-summary { font-size: 11.5px; color: var(--color-muted); margin-top: 6px; line-height: 1.6; }
/* LABOR_REPORT_UX_PLAN.md §9: selectはネイティブ実装上、選択中の値が長いと省略記号にできず
   見た目上どこまでが選択中か分かりにくくなる。選択中の値をテキストでも併記して全文を読めるようにする。 */
.labor-setup-card-selected-text {
  font-size: 11.5px;
  color: var(--color-muted);
  margin-top: 4px;
  line-height: 1.5;
}

.labor-setup-lock-note {
  font-size: 11px;
  color: var(--color-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.labor-setup-unlock-btn {
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: 6px;
  font-size: 11px;
  padding: 3px 8px;
  cursor: pointer;
  color: var(--color-muted);
}
.labor-setup-unlock-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }

.labor-setup-direction-tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}
.labor-setup-direction-tag.is-stricter { background: #eff6ff; color: #1d4ed8; }
.labor-setup-direction-tag.is-relaxed { background: #fef2f2; color: #b91c1c; }
.labor-setup-direction-tag.is-changed { background: #fefce8; color: #854d0e; }

.labor-setup-card.is-relaxed { border-color: #fca5a5; background: #fff7f7; }
.labor-setup-relax-reason {
  margin-top: 8px;
  width: 100%;
}
.labor-setup-relax-reason label {
  display: block;
  font-size: 11px;
  color: #b91c1c;
  margin-bottom: 3px;
}
.labor-setup-relax-reason input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  font-size: 12.5px;
}

/* --- 折りたたみ(🧭解釈・🔔通知)。開封で確認チェックが有効になる(§4.3) --- */
.labor-setup-collapse {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  margin-bottom: 14px;
  overflow: hidden;
}
.labor-setup-collapse-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--color-bg);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}
.labor-setup-collapse-head::after { content: '▾'; margin-left: auto; color: var(--color-muted); }
.labor-setup-collapse.is-open .labor-setup-collapse-head::after { content: '▴'; }
.labor-setup-collapse-body { padding: 12px; display: none; }
.labor-setup-collapse.is-open .labor-setup-collapse-body { display: block; }
.labor-setup-collapse.is-opened-once .labor-setup-collapse-head { color: #15803d; }

/* --- 確認チェック(各ステップ末尾、§4.3) --- */
.labor-setup-confirm-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px dashed var(--color-border);
  border-radius: 8px;
  font-size: 12.5px;
  margin-top: 4px;
}
.labor-setup-confirm-check input[type='checkbox'] { width: 16px; height: 16px; }

/* --- ステップ2: 36協定/労使協定の対比(§4.2) --- */
.labor-setup-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
@media (max-width: 640px) {
  .labor-setup-compare { grid-template-columns: 1fr; }
}
.labor-setup-compare-box {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px;
}
.labor-setup-compare-box h4 { margin: 0 0 6px; font-size: 13px; }
.labor-setup-compare-box p { margin: 0 0 10px; font-size: 11.5px; color: var(--color-muted); line-height: 1.6; }

/* --- ステップ5: 法定の上限値テーブル --- */
.labor-setup-legal-summary { font-size: 12px; color: var(--color-muted); margin-bottom: 10px; }
.labor-setup-legal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin-bottom: 12px;
}
.labor-setup-legal-table th,
.labor-setup-legal-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}
.labor-setup-legal-table th { color: var(--color-muted); font-weight: 600; font-size: 11px; }
.labor-setup-legal-table tr.is-derived td { color: var(--color-muted); }

/* --- ステップ6: 特例の使用有無トグル --- */
.labor-setup-feature-toggle {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.labor-setup-feature-toggle-q { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.labor-setup-feature-toggle-opts { display: flex; gap: 14px; }
.labor-setup-feature-toggle-opts label { font-size: 12.5px; display: flex; align-items: center; gap: 4px; cursor: pointer; }

/* --- ステップ8: 確認と確定 --- */
.labor-setup-summary-section { margin-bottom: 14px; }
.labor-setup-summary-section h4 { font-size: 13px; margin: 0 0 6px; }
.labor-setup-summary-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.labor-setup-summary-table th, .labor-setup-summary-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}
.labor-setup-summary-empty { font-size: 12px; color: var(--color-muted); padding: 8px 0; }
.labor-setup-final-confirm {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--color-primary);
  border-radius: 8px;
  background: #eff6ff;
  font-size: 13px;
  margin-top: 10px;
}
.labor-setup-final-confirm input[type='checkbox'] { width: 18px; height: 18px; margin-top: 1px; }

/* --- やり直し確認ダイアログ(§7.2) --- */
.labor-setup-reopen-content { width: min(520px, 92vw); }
.labor-setup-reopen-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.7;
}
.labor-setup-reopen-warning ol { margin: 6px 0 10px; padding-left: 20px; }
.labor-setup-reopen-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}
.labor-setup-reopen-actions button {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
#labor-setup-reopen-confirm-btn {
  border: none;
  background: var(--color-danger);
  color: #fff;
}
#labor-setup-reopen-confirm-btn:disabled { opacity: 0.4; cursor: not-allowed; }
#labor-setup-reopen-cancel-btn { border: 1px solid var(--color-border); background: #fff; }

.labor-setup-history-content { width: min(560px, 92vw); }

/* --- L1: 労務モーダルの各タブへのオーバーレイ(§6.1、第3弾) --- */
.modal-tab-panel.labor-tab-gate-locked { position: relative; min-height: 120px; }
.modal-tab-panel.labor-tab-gate-locked > *:not(.labor-gate-banner) {
  opacity: 0.3;
  pointer-events: none;
  user-select: none;
  filter: blur(1px);
}
.labor-gate-banner {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 5;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 14px 16px;
  text-align: center;
}
.labor-gate-banner p { margin: 0 0 10px; font-size: 12.5px; color: #92400e; font-weight: 600; }

/* ---- 絞り込みコンボボックス(LABOR_REPORT_UX_PLAN.md §3) ---- */
.combobox { position: relative; display: inline-block; min-width: 0; }
.combobox-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 6px 26px 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  color: var(--color-text);
}
.combobox-input:focus { outline: none; border-color: var(--color-primary); }
.combobox-clear {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1;
  padding: 4px;
  cursor: pointer;
  border-radius: 3px;
}
.combobox-clear:hover { color: #dc2626; background: #fef2f2; }
.combobox-list {
  position: absolute;
  z-index: 40;
  top: 100%;
  left: 0;
  right: 0;
  margin: 4px 0 0;
  padding: 4px 0;
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.16);
}
.combobox-item {
  padding: 6px 10px;
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.combobox-item:hover,
.combobox-item.active { background: #eff6ff; }
.combobox-empty { padding: 6px 10px; font-size: 12.5px; color: var(--color-muted); }

/* ---- M5 PTT(ハードウェアボタン、PTT_HARDWARE_PLAN.md 18-19章) ---- */
.m5-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 10px;
  border: 1px solid var(--color-border, #d1d5db);
  background: none;
  font-size: 12px;
  cursor: pointer;
}
.m5-chip-on {
  border-color: #16a34a;
  color: #166534;
  background: #f0fdf4;
}
.m5-modal-content {
  width: min(560px, 92vw);
}
.m5-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  flex-wrap: wrap;
}
.m5-settings label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-size: 13px;
}
.m5-hour {
  width: 60px;
}
.m5-help {
  margin: 4px 0 12px 18px;
  font-size: 13px;
  line-height: 1.7;
}
.m5-log {
  height: 180px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--color-border, #d1d5db);
  border-radius: 6px;
  background: #f9fafb;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}
