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

/* ============================================================
   ブランドカラー変数（元気でんきオレンジ固定）
   将来の拡張に備えて変数構造は維持する
   ============================================================ */
:root {
  --brand: #EB6600;        /* 主色（旧 1D9E75 の置換先） */
  --brand-hover: #b35a00;  /* hover濃色（旧 178a63 の置換先） */
  --brand-tint: #FBE0CC;   /* 淡色1（旧 e8f7f2 の置換先） */
  --brand-tint-2: #FBE0CC; /* 淡色2（旧 eafaf3 の置換先） */
}

body {
  background: #F4F4F1;
  font-family: 'Roboto', 'Noto Sans JP', 'Hiragino Kaku Gothic Pro', 'Meiryo', sans-serif;
  color: #333333;
  min-height: 100vh;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ============================================================
   アプリ全体レイアウト（サイドバー＋メインコンテンツ）
   HTML結線（.app-layout / main.app-main の設置）は後続ステップで対応。
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

main.app-main {
  flex: 1;
  min-width: 0;
  padding: 2rem 0;
}

/* ===== サイドバー本体（nav.js が #app-nav に注入） ===== */
.app-sidebar {
  width: 240px;
  min-width: 240px;
  background: #333333;
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: width 0.2s ease, min-width 0.2s ease;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  /* 上部余白はハンバーガーボタン（fixed, top:16px/left:16px, height:36px想定）との重なりを避ける分だけ確保 */
  padding: 64px 20px 24px;
}

.sidebar-logo svg {
  width: 100px;
  height: auto;
  display: block;
  color: #fff;
}

.sidebar-appname {
  width: 180px;
}

.sidebar-appname svg {
  width: 100%;
  height: auto;
  display: block;
  color: #fff;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  padding: 8px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 14px;
  border-radius: 0;
  border-left: 3px solid transparent;
  color: #ccc;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-item.active {
  background: rgba(235, 102, 0, 0.18);
  border-left-color: var(--brand);
  color: #fff;
  font-weight: 600;
}

.sidebar-footer {
  padding: 12px 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-admin-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #999;
  text-decoration: none;
}

.sidebar-admin-link:hover {
  color: #fff;
  text-decoration: underline;
}

/* ===== ハンバーガー開閉ボタン（nav.js が注入。常時固定表示） ===== */
.nav-toggle-btn {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 1100;
  width: 36px;
  height: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  box-shadow: none;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.nav-toggle-btn:hover {
  border-color: var(--brand);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.nav-toggle-bar {
  display: block;
  width: 16px;
  height: 1.5px;
  border-radius: 1px;
  background: #333333;
  transition: background 0.15s;
}

.nav-toggle-btn:hover .nav-toggle-bar {
  background: var(--brand);
}

/* ===== モバイル用backdrop（nav.js が注入。PCでは非表示のまま） ===== */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 900;
}

/* PC: サイドバー折りたたみ（幅0へアニメーション） */
body.sidebar-collapsed .app-sidebar {
  width: 0;
  min-width: 0;
}

/* ロゴ */
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2rem;
}

/* 管理者メニューボタン */
.admin-menu-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 16px;
  border: 1.5px solid var(--brand);
  border-radius: 20px;
  color: var(--brand);
  background: white;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.admin-menu-btn:hover {
  background: var(--brand);
  color: white;
}

.gear-item {
  width: 100%;
  height: 38px;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.gear-item:hover {
  background: var(--brand-hover);
}

.gear-item:disabled {
  background: #aaa;
  cursor: not-allowed;
}

.gear-error {
  font-size: 12px;
  color: #d94040;
  min-height: 14px;
}

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-text {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ラベル */
label {
  display: block;
  font-size: 13px;
  color: #555;
  margin-bottom: 6px;
}

/* 検索ボックス */
.search-wrap {
  position: relative;
}

#search-input {
  width: 100%;
  height: 44px;
  border: 1.5px solid #ccc;
  border-radius: 8px;
  padding: 0 40px 0 14px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
  background: white;
}

#search-input:focus {
  border-color: var(--brand);
}

.search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  pointer-events: none;
  opacity: 0.5;
}

/* ユーティリティ */
.hidden {
  display: none;
}

.error-msg {
  color: #d94040;
  font-size: 14px;
  margin-top: 8px;
}

/* 検索結果一覧（広い画面では2列グリッド、狭い画面では1列） */
#results-list {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.result-card {
  background: white;
  border-radius: 10px;
  border: 0.5px solid #ddd;
  padding: 12px 16px;
  cursor: default;
}

.result-card-city {
  font-size: 13px;
  color: #555;
  margin-bottom: 4px;
}

.result-card-depots {
  display: flex;
  flex-direction: column;
  font-size: 17px;
  font-weight: 500;
  color: var(--brand);
}

/* デポ1行分（左: デポ名 / 右: 候補日トグル） */
.depot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
}

/* 2行目以降・候補日パネルの直後の行は薄い区切り線 */
.depot-row + .depot-row,
.avail-panel + .depot-row {
  border-top: 1px solid #eee;
}

.no-results {
  font-size: 13px;
  color: #999;
  padding: 12px 0;
  text-align: center;
}

.loading-msg {
  font-size: 13px;
  color: #888;
  padding: 12px 0;
  text-align: center;
}

.search-hint {
  font-size: 12px;
  color: #888;
  padding: 6px 2px 2px;
}

.search-legend {
  margin: 4px 0 12px;
  font-size: 11px;
  color: #999;
  line-height: 1.8;
}

.search-legend-title {
  font-weight: 600;
  color: #888;
}

#area-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1.25rem;
}

.area-btn {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1.5px solid #ccc;
  background: white;
  color: #555;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  white-space: nowrap;
}

.area-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.area-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
  font-weight: 500;
}

/* タブ */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 1.5rem;
}

.tab-btn {
  padding: 6px 20px;
  border-radius: 20px;
  border: 1.5px solid #ccc;
  background: white;
  color: #555;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  white-space: nowrap;
}

.tab-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.tab-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
  font-weight: 500;
}

.tab-content.hidden {
  display: none;
}

/* 地図（PC向けに拡大） */
#map {
  height: 55vh;
  min-height: 400px;
  width: 100%;
  border-radius: 10px;
  border: 0.5px solid #ddd;
  background: white;
}

/* no-results 等が空でグリッド外の単独表示になっても崩れないように */
.no-results,
.error-msg,
.loading-msg {
  grid-column: 1 / -1;
}

/* エリア別 表示ON/OFFトグル（閲覧画面のみ）。エリアごとの行を縦に並べる */
#area-toggle {
  margin: 8px 0;
}

#area-toggle:empty {
  display: none;
}

/* 1行 = 左端エリアボタン＋右にそのエリアのデポボタン群 */
.toggle-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

/* 「すべて表示/非表示」ヘッダー行は下に少し余白を取り区切る */
.toggle-allrow {
  margin-bottom: 10px;
}

.area-toggle-lead {
  font-size: 12px;
  color: #555;
  margin-right: 2px;
}

.area-toggle-btn {
  display: inline-flex;
  align-items: center;
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid #ccc;
  background: #fff;
  color: #555;
  /* 左端のエリアボタンが縦に揃って見えるよう幅を固定し中央寄せ */
  min-width: 84px;
  justify-content: center;
  text-align: center;
  /* 全OFF（非active）はグレーアウト */
  opacity: 0.5;
  transition: border-color 0.15s, background 0.15s, color 0.15s, opacity 0.15s;
}

/* 全ON（active）：塗り */
.area-toggle-btn.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  opacity: 1;
}

/* 一部ON（partial）：点線枠＋淡色背景で区別 */
.area-toggle-btn.partial {
  border-style: dashed;
  border-color: var(--brand);
  background: var(--brand-tint-2);
  color: var(--brand);
  opacity: 1;
}

/* デポ別 表示ON/OFFトグルボタン（エリア行内に配置） */
.depot-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border: 1px solid #ccc;
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: #555;
  transition: border-color 0.15s, color 0.15s, opacity 0.15s;
}

.depot-toggle-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 0.5px solid #ccc;
  background: #e0e0e0;
  flex-shrink: 0;
}

.depot-toggle-btn.active {
  border-color: var(--brand);
  color: #222;
}

/* OFF（非選択）はグレーアウトで明示 */
.depot-toggle-btn:not(.active) {
  opacity: 0.45;
}

/* 「すべて表示/非表示」ボタンは軽く区別 */
.depot-toggle-all {
  background: #f5f5f0;
  font-weight: 500;
  opacity: 1;
  text-decoration: none;
}

.depot-toggle-all:hover {
  border-color: var(--brand);
  color: var(--brand);
}

/* 凡例 */
#map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  margin-top: 12px;
  font-size: 12px;
  color: #555;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 0.5px solid #ccc;
  flex-shrink: 0;
}

.legend-note {
  width: 100%;
  color: #999;
  font-size: 11px;
}

/* クリック情報カード */
#map-info {
  margin-top: 12px;
}

#map-info:empty {
  display: none;
}

/* 未割当時のデポ表示は控えめ（グレー）にする */
.result-card-depots-none {
  color: #999;
  font-weight: 400;
}

/* 編集UI（.map-edit）が続く場合は、上のカードの下角を直角にして連結させる */
#map-info:has(.map-edit) > .result-card {
  border-bottom: none;
  border-radius: 10px 10px 0 0;
}

/* 未マッチ */
#unmatched-box {
  margin-top: 16px;
  font-size: 12px;
  color: #888;
}

#unmatched-box summary {
  cursor: pointer;
  color: #777;
}

#unmatched-list {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.unmatched-item {
  color: #999;
}

/* 管理者編集UI（地図クリックパネル内） */
#map-info > .map-edit {
  background: white;
  border: 0.5px solid #ddd;
  border-top: none;
  border-radius: 0 0 10px 10px;
  padding: 0 16px 14px;
  margin-top: -1px;
}

.map-edit-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.map-edit-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f5f5f0;
  border: 0.5px solid #ddd;
  border-radius: 16px;
  padding: 3px 6px 3px 12px;
  font-size: 13px;
  color: #333;
}

.map-edit-remove {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: #d94040;
  color: white;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.map-edit-remove:hover {
  background: #b83030;
}

.map-edit-remove:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.map-edit-empty {
  font-size: 13px;
  color: #999;
}

.map-edit-add {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.map-edit-select,
.map-edit-new {
  flex: 1;
  height: 36px;
  border: 1.5px solid #ccc;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
  font-family: inherit;
  background: white;
  outline: none;
  transition: border-color 0.15s;
  min-width: 0;
}

.map-edit-select:focus,
.map-edit-new:focus {
  border-color: var(--brand);
}

.map-edit-add-btn,
.map-edit-new-btn {
  height: 36px;
  padding: 0 14px;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.map-edit-add-btn:hover,
.map-edit-new-btn:hover {
  background: var(--brand-hover);
}

.map-edit-add-btn:disabled,
.map-edit-new-btn:disabled {
  background: #aaa;
  cursor: not-allowed;
}

.map-edit-error {
  font-size: 12px;
  color: #d94040;
  min-height: 14px;
}

/* 地図の常時ラベル（デポ付き市区町村・ズームイン時） */
.city-label {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 10px;
  line-height: 1.2;
  color: #333;
  white-space: nowrap;
  pointer-events: none;
  width: auto !important;
  height: auto !important;
  /* 透過背景でも色付きポリゴン上で読めるよう白いハロー（縁取り）を付ける */
  text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 2px #fff;
}

/* Leaflet div-icon の既定枠・背景を打ち消す */
.leaflet-div-icon.city-label {
  border: none;
  background: transparent;
}

/* デポマスタの住所に立てるピン */
.depot-pin {
  background: transparent;
  border: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 3px;
  pointer-events: none;
}

.depot-pin-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d83b01;
  border: 2px solid #fff;
  box-shadow: 0 0 2px rgba(0, 0, 0, .4);
}

.depot-pin-name {
  font-size: 11px;
  font-weight: 500;
  color: #b3300a;
  text-shadow: 0 0 2px #fff, 0 0 2px #fff;
}

.leaflet-div-icon.depot-pin {
  background: transparent;
  border: none;
}

/* ホバー時ツールチップ */
.leaflet-tooltip {
  font-size: 12px;
}

/* 管理ページ共通ヘッダー */
.page-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 1.75rem;
}

.back-link {
  color: var(--brand);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}

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

.page-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* メインコンテンツ最上部に単独表示する機能名タイトル
   （nav.js がサイドメニューのactive項目名を注入。.page-header内で使う
   管理系ページの.page-titleとは独立して余白を持たせる） */
.app > .page-title {
  display: block;
  margin-bottom: 1.5rem;
}

/* 管理者ゲート（未ログイン案内） */
.admin-gate {
  background: white;
  border: 0.5px solid #ddd;
  border-radius: 12px;
  padding: 2rem 1.5rem;
  max-width: 420px;
  margin: 2rem auto;
  text-align: center;
}

.admin-gate-msg {
  font-size: 15px;
  color: #555;
  margin-bottom: 1.25rem;
}

/* 管理者ログインフォーム（都度パスワード要求） */
.admin-login-input {
  width: 100%;
  height: 40px;
  border: 1.5px solid #ccc;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14px;
  font-family: inherit;
  background: white;
  outline: none;
  transition: border-color 0.15s;
  margin-bottom: 12px;
}

.admin-login-input:focus {
  border-color: var(--brand);
}

.admin-login-btn {
  width: 100%;
}

.admin-login-error {
  font-size: 12px;
  color: #d94040;
  min-height: 14px;
  margin-top: 10px;
}

/* 地図編集パネル内のマスタ案内リンク */
.map-edit-link {
  color: var(--brand);
  font-size: 13px;
  text-decoration: underline;
  align-self: center;
}

/* デポマスタ画面 */
.dm-add-form {
  background: white;
  border: 0.5px solid #ddd;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 1.5rem;
}

.dm-add-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dm-input {
  height: 38px;
  border: 1.5px solid #ccc;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14px;
  font-family: inherit;
  background: white;
  outline: none;
  transition: border-color 0.15s;
  min-width: 0;
}

.dm-input:focus {
  border-color: var(--brand);
}

.dm-add-row .dm-input:first-child {
  flex: 1 1 200px;
}

.dm-add-row .dm-input:nth-child(2) {
  flex: 2 1 280px;
}

.dm-add-btn {
  width: auto;
  padding: 0 22px;
  flex-shrink: 0;
}

.dm-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: 0.5px solid #ddd;
  border-radius: 12px;
  overflow: hidden;
  font-size: 14px;
}

.dm-table th,
.dm-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 0.5px solid #eee;
  vertical-align: middle;
}

.dm-table thead th {
  background: #f5f5f0;
  color: #555;
  font-size: 12px;
  font-weight: 600;
}

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

.dm-th-ops {
  width: 220px;
}

.dm-cell-name {
  font-weight: 500;
  color: var(--brand);
}

.dm-cell-addr {
  color: #555;
}

.dm-cell-ops {
  white-space: nowrap;
}

.dm-cell-name .dm-input,
.dm-cell-addr .dm-input {
  width: 100%;
}

.dm-op-btn {
  height: 30px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1.5px solid #ccc;
  background: white;
  color: #555;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  margin-right: 6px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.dm-op-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.dm-op-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dm-save-btn {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.dm-save-btn:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  color: white;
}

.dm-del-btn:hover {
  border-color: #d94040;
  color: #d94040;
}

.dm-row-error {
  font-size: 12px;
  color: #d94040;
  margin-top: 4px;
  white-space: normal;
}

/* デポマスタ 有効/無効トグル */
.dm-active-btn {
  height: 28px;
  min-width: 52px;
  padding: 0 10px;
  border-radius: 14px;
  border: 1.5px solid #ccc;
  background: #f5f5f5;
  color: #999;
  font-size: 12px;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.dm-active-btn.on {
  background: var(--brand-tint);
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 600;
}
.dm-active-btn:hover {
  opacity: 0.8;
}
.dm-th-active {
  width: 72px;
  text-align: center;
  white-space: nowrap;
}
.dm-cell-active {
  text-align: center;
  white-space: nowrap;
}

/* ===== 地図編集 操作バー（デポ選択／保存／リセット／ヒント） ===== */
.edit-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: white;
  border: 0.5px solid #ddd;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 12px;
}

/* アクション行（編集中デポ表示・保存・リセット・ヒント） */
.edit-bar-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

.edit-bar-status {
  font-size: 14px;
  color: #555;
}

.edit-current-depot {
  font-weight: 600;
  color: var(--brand);
}

.edit-current-depot.edit-current-none {
  color: #999;
  font-weight: 400;
}

.edit-bar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.edit-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.edit-save-btn:hover:not(:disabled) {
  background: var(--brand-hover);
}

.edit-save-btn:disabled {
  background: #aaa;
  cursor: not-allowed;
}

.edit-dirty-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #b35a00;
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.edit-dirty-badge.hidden {
  display: none;
}

.edit-reset-btn {
  height: 36px;
  padding: 0 14px;
  background: white;
  color: #777;
  border: 1.5px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.edit-reset-btn:hover:not(:disabled) {
  border-color: #b35a00;
  color: #b35a00;
}

.edit-reset-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.edit-bar-hint {
  font-size: 12px;
  color: #999;
}

.edit-bar-msg {
  width: 100%;
  font-size: 13px;
  min-height: 16px;
}

.edit-bar-msg-error {
  color: #d94040;
}

.edit-bar-msg-ok {
  color: var(--brand);
}

/* 結果カード下のヒント（デポ未選択時） */
.edit-card-hint {
  font-size: 13px;
  color: #b35a00;
  margin-top: 6px;
}

/* ===== デポ選択（単一選択・エリア行レイアウト） ===== */
.depot-pick-label {
  font-size: 13px;
  color: #555;
  margin: 0;
}

#depot-pick {
  margin-bottom: 0;
}

/* 行ラベル（エリア見出し）は選択用ではないので非トグル表示 */
.depot-pick-lead {
  min-width: 84px;
  text-align: right;
  font-weight: 500;
  color: #555;
}

/* デポ選択ボタン（.depot-toggle-btn の体裁を踏襲しつつ単一選択用） */
.depot-pick-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border: 1px solid #ccc;
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: #555;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.depot-pick-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.depot-pick-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 0.5px solid #ccc;
  background: #e0e0e0;
  flex-shrink: 0;
}

/* 選択中（編集対象）ハイライト */
.depot-pick-btn.selected {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
  font-weight: 600;
}

/* エリア未選択時のデポ選択欄プレースホルダ */
.depot-pick-hint {
  font-size: 13px;
  color: #888;
  padding: 4px 0;
}

/* ===== エリア選択（単一選択・デポ選択の絞り込み条件） ===== */
.area-pick-btn {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  border: 1px solid #ccc;
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: #555;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.area-pick-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.area-pick-btn.selected {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
  font-weight: 600;
}

/* デポ名リンク（検索結果・地図パネル共通） */
.depot-link {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}
.depot-link:hover {
  text-decoration: underline;
}

/* 候補日ボタン（検索結果・クリックで日程調整候補日パネルを展開） */
.avail-btn {
  font-size: 12px;
  padding: 2px 10px;
  margin-left: 6px;
  border: 1px solid var(--brand);
  color: var(--brand);
  background: #fff;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
}
.avail-btn:hover {
  background: var(--brand-tint);
}

/* 日程調整候補日パネル（デポ行の直下に内包表示。行との区切り線は付けない） */
.avail-panel {
  margin-top: 0;
  padding: 0 0 12px;
}

.avail-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.avail-panel-title {
  font-size: 12px;
  color: #888;
}

.avail-day {
  font-size: 13px;
  line-height: 1.6;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
}

.avail-date {
  font-weight: 600;
  min-width: 64px;
}

.avail-rank {
  font-weight: 500;
}

.avail-badge {
  background: var(--brand-tint);
  color: var(--brand);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 12px;
}

.avail-badge-kanri { background: #FA9D2C; color: #fff; }
.avail-badge-hanbai { background: #8175C7; color: #fff; }

.avail-near-badge {
  background: #fff3e6;
  color: #b35a00;
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 12px;
}

.avail-near-same {
  /* 既存の near-badge 色のまま（強調） */
}

.avail-near-adj {
  background: #fdf3e7;
  color: #c07a33;
}

.avail-badge-off {
  background: #ececec !important;
  color: #9a9a9a !important;
}

.avail-comment {
  font-size: 12px;
  color: #b35a00;
}


.avail-loading,
.avail-empty,
.avail-error {
  font-size: 13px;
}

.avail-loading {
  color: #888;
}

.avail-empty {
  color: #999;
}

.avail-error {
  color: #d94040;
}

/* デポマスタ一覧のURL列リンク */
.depot-url-link {
  color: var(--brand);
  font-size: 13px;
  text-decoration: none;
}
.depot-url-link:hover {
  text-decoration: underline;
}

/* ===== 総枠数集計タブ ===== */
.capacity-depot-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1.25rem;
}

.capacity-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.5rem;
}

.capacity-controls label {
  margin-bottom: 0;
}

.capacity-controls input[type="date"] {
  height: 38px;
  border: 1.5px solid #ccc;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 14px;
  font-family: inherit;
  background: white;
  outline: none;
  transition: border-color 0.15s;
}

.capacity-controls input[type="date"]:focus {
  border-color: var(--brand);
}

.capacity-total {
  background: white;
  border: 0.5px solid #ddd;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 8px;
}

.capacity-total-num {
  font-size: 48px;
  font-weight: 700;
  color: var(--brand);
  line-height: 1.2;
}

.capacity-sub {
  font-size: 13px;
  color: #555;
  margin-bottom: 4px;
}

.capacity-partial-note {
  font-size: 12px;
  color: #b35a00;
  margin-bottom: 4px;
}

.capacity-daily-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: 0.5px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  font-size: 13px;
  margin-top: 8px;
}

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

.capacity-daily-table thead th {
  background: #f5f5f0;
  color: #555;
  font-size: 12px;
  font-weight: 600;
}

.capacity-day-row {
  cursor: pointer;
}

.capacity-day-row:hover td {
  background: #f5f5f0;
}

.capacity-expand-marker {
  display: inline-block;
  width: 1em;
  color: #888;
}

.capacity-detail-row td {
  background: #fafaf7;
  padding: 8px 12px;
}

.capacity-detail-subtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  color: #555;
}

.capacity-detail-subtable th,
.capacity-detail-subtable td {
  text-align: left;
  padding: 4px 8px;
  border-bottom: 0.5px solid #e5e5e0;
}

.capacity-detail-subtable th {
  color: #777;
  font-weight: 600;
}

.capacity-detail-subtable tr:last-child td {
  border-bottom: none;
}

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

/* レスポンシブ: 狭い画面では padding を抑える */
@media (max-width: 640px) {
  .app {
    padding: 1.5rem 1rem;
  }
  #results-list {
    grid-template-columns: 1fr;
  }
  .dm-th-ops {
    width: auto;
  }

  /* サイドバーはオーバーレイ表示（既定は閉＝画面外） */
  .app-layout {
    display: block;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    min-width: 240px;
    height: 100vh;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

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

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }

  /* PC由来の sidebar-collapsed クラスが残っていても、モバイルでは
     transform による開閉のみを表示制御に使う（width:0 との競合を断つ） */
  body.sidebar-collapsed .app-sidebar {
    width: 240px;
    min-width: 240px;
  }

  main.app-main {
    padding: 1.5rem 0;
  }
}

