:root {
  --teal: #0f766e;
  --teal-dark: #0b5c56;
  --teal-light: #ccfbf1;
  --bg: #f4f6f5;
  --card-bg: #ffffff;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --warn: #d97706;
  --warn-light: #fef3c7;
  --radius: 14px;
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* 2026-07-01修正⑧: 横スワイプ(日付送り)が画面下部で効かない不具合の修正。
   原因: main.card-list の高さがコンテンツ量に依存しており、画面最下部の余白部分は
   main要素の"外"（bodyの背景）になっていたため、そこでの横スワイプを拾えなかった。
   対策: htmlをflexコンテナ化し、main.card-listがtopbar/link-bar/scroll-hint等を除いた
   残り全高を占めるようにする（min-height:0でflexの縮小計算を効かせる）。
   これによりボード領域はどの高さでも横スクロールのタッチイベントを拾える。 */
html {
  height: 100%;
}

body {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--teal);
  color: white;
  padding: 14px 16px 10px;
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
}

.topbar-sub {
  margin-top: 4px;
  font-size: 12.5px;
  opacity: 0.88;
  font-variant-numeric: tabular-nums;
}

/* トップバー右側のアクション群（更新・ログアウト）を横並びに */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 更新ボタン（永井さん修正F・2026-07-01: グリッド最新データの取り込み） */
.btn-refresh {
  flex: 0 0 auto;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.12);
  color: white;
  font-size: 13px;
  font-weight: 700;
}

.btn-refresh:disabled {
  opacity: 0.6;
}

/* 2026-07-01修正⑦: フィルタタブ（未確定+確定済み／未確定のみ／確定済みのみ）のUIは全削除済み。
   常に未確定+確定済みを表示するだけの固定仕様のため、対応するCSSも撤去した。 */

.scroll-hint {
  text-align: center;
  font-size: 10.5px;
  color: var(--text-muted);
  padding: 5px 0 2px;
  background: var(--bg);
}

/* 連日イベント結合バー（要件①）: 最上部（フィルタタブより上）に固定配置 */
.link-bar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  position: sticky;
  top: 58px;
  z-index: 10;
}

.link-mode-btn {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1.5px dashed var(--teal);
  background: var(--teal-light);
  color: var(--teal-dark);
  font-size: 13.5px;
  font-weight: 700;
}

.link-mode-btn.active {
  background: var(--teal);
  color: white;
  border-style: solid;
}

.link-mode-actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.link-mode-actions.hidden {
  display: none;
}

.link-mode-hint {
  flex: 1;
  font-size: 12px;
  color: var(--text-muted);
}

.btn-small {
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}

.btn-ghost {
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-primary {
  background: var(--teal);
  color: white;
}

.btn-primary:disabled {
  background: #9ca3af;
}

/* 候補一覧＝日付列ボード（永井さん依頼・2026-07-01作り替え）
   1日=1列、列を左→右に日付順で並べ、コンテナ全体を横スクロール。
   各列は「日付見出し＋その日の候補を縦積み」で、列ごとに縦スクロールする（全体を縦に流さない）。
   390幅で4〜5列が画面内に収まるよう1列=84px幅に設定（永井さん修正B・2026-07-01: 70px→84px=1.2倍）。 */
.card-list {
  padding: 10px 8px;
  padding-bottom: 90px;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  /* 2026-07-01修正⑧: bodyのflexアイテムとして残り全高を占める（min-height:0でflex縮小を許可）。
     これでボード領域が画面最下部まで到達し、下部でも横スワイプ(日付送り)を拾える。 */
  flex: 1 1 auto;
  min-height: 0;
  /* 2026-07-01追加(永井さん要件「結合グループを横断の大きな1セルで表示」):
     .span-cell-layer を絶対配置するための基準位置にする。 */
  position: relative;
}

/* 結合グループの横断セル表示用オーバーレイ層（永井さん追加要件・2026-07-01）。
   .card-list の子要素なので横スクロールに自然に追従する。position:absoluteでflexの通常フローから外し、
   各.day-columnの縦スクロール(overflow-y:auto)とは別レイヤーのため干渉しない。
   pointer-events:noneにして下の空白部分では通常のボードの横スワイプを妨げず、
   .span-cell自体だけpointer-events:autoでタップを拾えるようにする。 */
.span-cell-layer {
  position: absolute;
  /* 2026-07-01デバッグ修正: position:absoluteの基準は.card-listのpadding込みborder-boxの最上端。
     leftは.card-listのpadding-left(8px)を手動で足していたのに、topだけpadding-top(10px)を
     足し忘れていたため、横断セルが.day-columnの実際の開始位置より10px上にズレて
     列見出し(.day-column-header)に食い込んでいた（実測: 見出し下端との重なり11px）。
     left/top両方とも.card-listのpaddingぶんを明示的に足して基準を一致させる。 */
  top: 10px; /* .card-listのpadding-topぶん */
  left: 8px; /* .card-listのpadding-leftぶん */
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 3;
}

.span-cell {
  position: absolute;
  pointer-events: auto;
  box-sizing: border-box;
  background: var(--card-bg);
  border: 1.5px solid var(--teal);
  border-radius: 8px;
  padding: 5px 7px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(15, 118, 110, 0.15);
  overflow: hidden;
}

.span-cell:active {
  transform: scale(0.98);
}

.span-cell.status-confirmed {
  background: var(--teal-light);
}

.span-cell .card-store-name {
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.span-cell .card-store-carrier {
  font-size: 8.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.span-cell .card-names {
  font-size: 9.5px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.span-cell .card-badges {
  margin-top: 2px;
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
}

.span-cell .badge,
.span-cell .card-group-badge {
  font-size: 7px;
  padding: 1px 3px;
  border-radius: 4px;
}

.day-column {
  flex: 0 0 84px;
  width: 84px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  max-height: calc(100vh - 200px);
}

.day-column-header {
  flex: 0 0 auto;
  text-align: center;
  padding: 6px 2px 5px;
  background: var(--teal-light);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}

/* 2026-07-01(永井さん依頼): 土日の列を色分け（土=青系・日=赤系）。
   見出し背景と数字・曜日ラベルの色、列全体の枠色を変えて一目で土日が分かるようにする。 */
.day-column.is-sat { border-color: #bae6fd; }
.day-column.is-sat .day-column-header { background: #e0f2fe; border-bottom-color: #bae6fd; }
.day-column.is-sat .day-column-header .day-num,
.day-column.is-sat .day-column-header .day-label { color: #0369a1; }

.day-column.is-sun { border-color: #fecaca; }
.day-column.is-sun .day-column-header { background: #fee2e2; border-bottom-color: #fecaca; }
.day-column.is-sun .day-column-header .day-num,
.day-column.is-sun .day-column-header .day-label { color: #b91c1c; }

.day-column-header .day-num {
  font-size: 17px;
  font-weight: 800;
  color: var(--teal-dark);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.day-column-header .day-label {
  font-size: 9px;
  color: var(--teal-dark);
  opacity: 0.75;
  margin-top: 1px;
}

.day-column-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 40px;
}

.day-column-empty {
  font-size: 9.5px;
  color: var(--text-muted);
  text-align: center;
  padding: 10px 2px;
}

/* 2026-07-01デバッグ修正: 横断セル（結合グループ）が覆う列の本体先頭に置くスペーサー。
   横断セルは別レイヤーに絶対配置で重なるため、その段数ぶんの高さを空けて他候補をその下に押し出す。
   flexで縮まないよう固定し、当たり判定も持たせない（横スワイプ・タップは下の列/横断セルが拾う）。 */
.span-reserve {
  flex: 0 0 auto;
  pointer-events: none;
}

/* 日付列ボード内の候補カード（コンパクト） */
.day-column .candidate-card {
  flex-direction: column;
  align-items: stretch;
  padding: 5px 6px;
  gap: 2px;
  border-radius: 7px;
  width: 100%;
}

.day-column .card-date {
  display: none; /* 列見出しに日付があるためカード内では非表示 */
}

.day-column .card-main {
  width: 100%;
}

.day-column .card-store {
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

/* 店舗名／キャリアの2段組み表示（永井さん修正A・2026-07-01） */
.day-column .card-store-name {
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.day-column .card-store-carrier {
  font-size: 8.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  margin-top: 1px;
}

.day-column .card-names {
  font-size: 9.5px;
  margin-top: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-column .card-badges {
  margin-top: 2px;
  gap: 2px;
}

.day-column .badge,
.day-column .card-group-badge {
  font-size: 7.5px;
  padding: 1px 4px;
  border-radius: 4px;
}

.day-column .card-chevron {
  display: none;
}

.day-column .candidate-card.status-confirmed {
  border-color: var(--teal);
  background: var(--teal-light);
}

.day-column .candidate-card.status-rejected {
  opacity: 0.5;
  background: var(--bg);
}

.day-column .candidate-card.status-pending {
  background: var(--card-bg);
}

/* 連日結合グループの列またぎ表示: グループの代表列にのみカードを出し、
   結合範囲を示すバッジを表示する（グループの他の列は「連日イベントの一部」として簡略表示） */
.day-column .candidate-card.is-group-member {
  border-style: dashed;
  opacity: 0.7;
}

/* 結合モード中の日付列ボード上の選択カード（2026-07-01修正②: ボードのまま結合操作） */
.day-column .link-board-card {
  flex-direction: row;
  align-items: center;
  gap: 4px;
  padding: 4px 5px;
}

.day-column .link-board-card .link-select-check {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  font-size: 10px;
  flex: 0 0 auto;
}

.day-column .link-board-card.link-selectable {
  border-color: var(--teal);
  border-style: dashed;
}

.day-column .link-board-card.link-selected {
  border-color: var(--teal);
  border-style: solid;
  border-width: 1.5px;
  background: var(--teal-light);
}

.day-column .link-board-card.link-disabled {
  opacity: 0.3;
  pointer-events: none;
}

.loading, .empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 12px;
  font-size: 14px;
}

.candidate-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.08s ease;
}

.candidate-card:active {
  transform: scale(0.98);
}

.candidate-card.status-confirmed {
  border-color: var(--teal);
  background: var(--teal-light);
}

.candidate-card.status-rejected {
  opacity: 0.55;
}

/* 結合モード中の選択状態（要件①） */
.candidate-card.link-selectable {
  border-color: var(--teal);
  border-style: dashed;
}

.candidate-card.link-selected {
  border-color: var(--teal);
  border-style: solid;
  border-width: 2px;
  background: var(--teal-light);
}

.candidate-card.link-disabled {
  opacity: 0.35;
  pointer-events: none;
}

.link-select-check {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: white;
  font-weight: 800;
}

.link-select-check.checked {
  background: var(--teal);
  border-color: var(--teal);
}

.card-group-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: #e0f2fe;
  color: #0369a1;
}

.card-date {
  flex: 0 0 auto;
  width: 52px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.card-date .day-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--teal-dark);
  line-height: 1;
}

.card-date .day-label {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-main {
  flex: 1;
  min-width: 0;
}

.card-store {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.card-store-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.card-store-carrier {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 1px;
}

.card-names {
  margin-top: 3px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-badges {
  margin-top: 6px;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
}

.badge-review {
  background: var(--warn-light);
  color: var(--warn);
}

.badge-confirmed {
  background: var(--teal);
  color: white;
}

.badge-rejected {
  background: #e5e7eb;
  color: var(--text-muted);
}

/* 店舗未確定（store_raw="その他"）バッジ（永井さん補足①: 誤検出と紛らわしいため強調表示） */
.badge-other {
  background: #fee2e2;
  color: #b91c1c;
}

/* 2026-07-01追加: 氏名未確定枠バッジ（永井さん要件「枠は押さえているが人が未定」）。
   店舗未確定(赤)とは別軸のため色・文言を変えて紛れないようにする（黄色系＝紫寄り）。 */
.badge-needs-name {
  background: #fef3c7;
  color: #92400e;
}

.card-chevron {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 18px;
}

/* ボトムシート */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 22, 0.45);
  z-index: 20;
}

.sheet-overlay.hidden, .sheet.hidden {
  display: none;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 21;
  background: white;
  border-radius: 20px 20px 0 0;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.2);
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 10px auto 4px;
}

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

.sheet-title {
  font-size: 16px;
  font-weight: 700;
}

.sheet-close {
  border: none;
  background: transparent;
  color: var(--teal);
  font-size: 14px;
  font-weight: 600;
  padding: 8px;
}

.sheet-body {
  padding: 14px 16px 8px;
  overflow-y: auto;
  flex: 1;
}

.field-row {
  margin-bottom: 14px;
}

.field-row label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.field-row.two-col {
  display: flex;
  gap: 10px;
}

.field-row.two-col > div {
  flex: 1;
}

input[type="text"], input[type="date"], input[type="time"], select, textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* detail_textフォーマット刷新: 持ち物の複数行入力欄（改行区切りで■持ち物ブロックの各行になる） */
textarea {
  font-family: inherit;
  resize: vertical;
  line-height: 1.5;
}

/* 2026-07-01修正④⑤: 集合場所・緊急連絡先のプルダウン化に伴うselect要素の見た目統一 */
select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.6' fill='none' fill-rule='evenodd'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

input:focus, textarea:focus {
  outline: 2px solid var(--teal);
  outline-offset: -1px;
  background: white;
}

.name-chips {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* 結合グループの複数メンバー氏名入力（永井さん修正D対応・2026-07-01） */
.member-input-row {
  margin-bottom: 12px;
  padding: 10px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.member-input-row-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 5px;
}

.member-input-row input[type="text"] {
  margin-bottom: 0;
}

.name-chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--teal);
  background: white;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 600;
}

.name-chip.selected {
  background: var(--teal);
  color: white;
}

/* スタッフマスター紐付け（要件②） */
.staff-match-area {
  margin-top: 8px;
}

.staff-match-loading {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 0;
}

.staff-match-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.staff-match-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.staff-match-item.linked {
  border-color: var(--teal);
  background: var(--teal-light);
}

.staff-match-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.staff-match-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.staff-match-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--teal);
  background: white;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.staff-match-btn.linked-btn {
  background: var(--teal);
  color: white;
}

.staff-match-empty {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 2px;
}

.staff-linked-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--teal-light);
  color: var(--teal-dark);
  font-size: 11.5px;
  font-weight: 700;
}

.staff-unlink-x {
  cursor: pointer;
  font-weight: 900;
  padding: 0 2px;
}

/* 連日結合グループ情報バナー（要件①） */
.group-info-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  background: #e0f2fe;
  border: 1px solid #7dd3fc;
  font-size: 12.5px;
  color: #0369a1;
  font-weight: 600;
}

.link-unlink-btn {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #0369a1;
  background: white;
  color: #0369a1;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.seg-control {
  display: flex;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.seg-control button {
  flex: 1;
  padding: 10px 4px;
  border: none;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  border-right: 1px solid var(--border);
}

.seg-control button:last-child {
  border-right: none;
}

.seg-control button.selected {
  background: var(--teal);
  color: white;
}

.muted-label {
  color: var(--text-muted) !important;
}

.raw-preview {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-all;
}

.sheet-actions {
  display: flex;
  gap: 10px;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: white;
}

.btn {
  flex: 1;
  padding: 14px 10px;
  border-radius: 12px;
  border: none;
  font-size: 15px;
  font-weight: 700;
}

.btn-reject {
  background: var(--danger-light);
  color: var(--danger);
}

.btn-confirm {
  background: var(--teal);
  color: white;
}

.btn-confirm:disabled {
  background: #9ca3af;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #1f2937;
  color: white;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  z-index: 30;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

.toast.hidden {
  display: none;
}

.toast.toast-error {
  background: var(--danger);
}

/* ===== 登録済みイベントリスト＋再編集画面（2026-07-02） ===== */

.assign-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px 40px;
}

.assign-section {
  margin-bottom: 12px;
}

.assign-section-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}

.assign-caret {
  color: var(--teal);
  font-size: 12px;
  width: 14px;
}

.assign-count {
  margin-left: auto;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: 999px;
  padding: 2px 10px;
}

.assign-section-body {
  padding: 6px 2px 0;
}

.assign-empty {
  color: var(--text-muted);
  font-size: 13.5px;
  padding: 10px 12px;
}

.assign-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--teal);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
}

.assign-card:active {
  background: var(--teal-light);
}

.assign-card-date {
  font-weight: 700;
  font-size: 14.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.assign-linked-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--teal-dark);
  background: var(--teal-light);
  border-radius: 999px;
  padding: 1px 8px;
}

.assign-card-store {
  font-size: 14px;
  margin-top: 2px;
}

.assign-card-members {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.assign-card-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ビュー切替（候補ボード⇔登録済みリスト）で隠す要素。
   汎用 .hidden ルールはこのCSSに存在しない（sheet/toast等は個別定義）ため、切替対象をここで明示する。 */
.card-list.hidden,
.link-bar.hidden,
.scroll-hint.hidden,
.assign-list.hidden {
  display: none;
}

/* ===== ゴミ箱・詳細確認・カード操作ボタン（2026-07-02） ===== */

.link-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.link-bar-row .link-mode-btn {
  flex: 1;
}

.trash-open-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--text-muted);
  cursor: pointer;
}

.trash-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 999px;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 0 4px;
}

.trash-count.hidden {
  display: none;
}

.card-trash {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
}

.card-trash:active {
  color: var(--danger);
  background: var(--danger-light);
}

.candidate-card {
  position: relative;
}

.trash-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--card-bg);
}

.trash-item-main {
  flex: 1;
  min-width: 0;
}

.trash-item-date {
  font-weight: 700;
  font-size: 13.5px;
}

.trash-item-raw {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: pre-wrap;
  word-break: break-all;
}

.assign-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.assign-edit-btn,
.assign-detail-btn {
  flex: 1;
  border: 1px solid var(--teal);
  border-radius: 8px;
  padding: 8px 0;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.assign-edit-btn {
  background: var(--teal);
  color: white;
}

.assign-detail-btn {
  background: var(--card-bg);
  color: var(--teal-dark);
}

.detail-copy-text {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  font-size: 13.5px;
  line-height: 1.5;
  font-family: inherit;
  background: var(--bg);
  resize: vertical;
}

/* 店舗サジェスト・テンプレート（2026-07-02） */

.store-suggest-title {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.store-suggest-btn {
  display: inline-block;
  margin: 0 6px 6px 0;
  border: 1px solid var(--teal);
  border-radius: 999px;
  background: var(--teal-light);
  color: var(--teal-dark);
  font-size: 13.5px;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
}

.store-suggest-btn:active {
  background: var(--teal);
  color: white;
}

.tpl-actions {
  display: flex;
  gap: 8px;
}

.btn-ghost-wide {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  padding: 14px 0;
  cursor: pointer;
}

.tpl-actions .btn-confirm {
  flex: 1.4;
}

/* 勤怠管理タブ（2026-07-02） */

.kintai-section-header {
  cursor: default;
}

.kintai-card-status {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.kintai-plan,
.kintai-status {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--bg);
  color: var(--text-muted);
}

.kintai-status.kintai-ok {
  background: var(--teal-light);
  color: var(--teal-dark);
}

.kintai-status.kintai-pending,
.kintai-plan.kintai-pending {
  background: var(--danger-light);
  color: var(--danger);
}

.kintai-note {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 4px 20px;
}

/* topbarのボタンが4つになったため、狭い画面でも収まるよう少しだけ詰める */
.topbar-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ===== UI改善（2026-07-02・永井さん要望）: 常時表示3タブ・今日/明日の区切り・祝日 ===== */

/* 画面切替タブ（ヘッダー直下・常時表示） */
.view-tabs {
  display: flex;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

.view-tab {
  flex: 1;
  padding: 12px 0 10px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
}

.view-tab.active {
  color: var(--teal-dark);
  border-bottom-color: var(--teal);
  background: var(--teal-light);
}

/* 候補ボード: 今日の列を強調 */
.day-column.is-today {
  box-shadow: 0 0 0 2px var(--teal);
  border-color: var(--teal);
}

.day-today-mark {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--teal);
  color: white;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 8px;
  border-radius: 999px;
  z-index: 3;
  white-space: nowrap;
}

.day-column {
  position: relative;
  overflow: visible;
}

/* 候補ボード: 祝日マーク（列全体は日曜と同じ赤系 .is-sun を適用） */
.day-holiday-mark {
  display: inline-block;
  margin-left: 3px;
  background: #b91c1c;
  color: white;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  vertical-align: 1px;
}

/* 登録済み・勤怠: 今日/明日/過去セクションの色分け */
.assign-sec-today > .assign-section-header {
  border-left: 5px solid var(--teal);
  background: var(--teal-light);
  color: var(--teal-dark);
}

.assign-sec-today > .assign-section-header .assign-count {
  background: rgba(255, 255, 255, 0.75);
  color: var(--teal-dark);
}

.assign-sec-tomorrow > .assign-section-header {
  border-left: 5px solid var(--warn);
  background: var(--warn-light);
  color: #92400e;
}

.assign-sec-tomorrow > .assign-section-header .assign-count {
  background: rgba(255, 255, 255, 0.75);
  color: #92400e;
}

.assign-sec-past > .assign-section-header {
  color: var(--text-muted);
  background: var(--bg);
}

/* 勤怠: データの出どころ説明 */
.kintai-info {
  background: var(--warn-light);
  border: 1px solid #fde68a;
  color: #92400e;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.6;
  margin-bottom: 12px;
}

.kintai-day-chip {
  font-weight: 800;
  font-size: 15px;
}

/* ===== 2026-07-02 追加修正（永井さんフィードバック第2弾） ===== */

/* 登録済み: 開閉したら中のイベントを右にずらして段差を付ける */
.assign-section-body.assign-indent {
  margin-left: 14px;
  padding-left: 10px;
  border-left: 2px solid var(--border);
}

/* 勤怠カード: 名前を主役に、状態はバッジで右側へ */
.kintai-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kintai-name {
  font-weight: 700;
  font-size: 15.5px;
}

.kintai-badge {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

.kintai-badge.kintai-ok {
  background: var(--teal-light);
  color: var(--teal-dark);
}

.kintai-badge.kintai-pending {
  background: var(--danger-light);
  color: var(--danger);
}

.kintai-badge.kintai-neutral {
  background: var(--bg);
  color: var(--text-muted);
}

/* 勤怠カード: 項目を縦に並べる（1行=ラベル左・状態右） */
.kintai-rows {
  margin-top: 8px;
}

.kintai-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 0;
  border-top: 1px dashed var(--border);
}

.kintai-row:first-child {
  border-top: none;
  padding-top: 2px;
}

.kintai-row-label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 600;
}

/* UI担当審査（2026-07-02）反映: 異常の2段階化とカードの強調 */

/* danger=今すぐの異常(寝坊中) / warn=猶予のある異常(未報告)。warnは注意書き(.kintai-info)と
   区別するため枠線付き */
.kintai-badge.kintai-danger {
  background: var(--danger-light);
  color: var(--danger);
}

.kintai-badge.kintai-warn {
  background: var(--warn-light);
  color: #92400e;
  border: 1px solid #fde68a;
}

/* 異常を含むカードは左端アクセントバーでリスト内でも目立たせる */
.kintai-card.has-danger {
  border-left: 4px solid var(--danger);
}

.kintai-card.has-warn {
  border-left: 4px solid var(--warn);
}

/* ラベルは添え書きに徹する（バッジと張り合わない） */
.kintai-row-label {
  font-size: 12px;
  font-weight: 500;
}

/* 起床グループ(予定・状況)と入店グループの区切りを実線で強調（近接の原則） */
.kintai-row.kintai-row-clockin {
  border-top: 1px solid var(--border);
  margin-top: 2px;
}

/* 1ユーザー担当の指摘（2026-07-02）反映 */

/* 候補ボードの文字を大きく（幅84px列のため折り返しを許可して読めるサイズに） */
.day-column .card-store-name {
  font-size: 12px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.day-column .card-store-carrier {
  font-size: 10px;
}

.day-column .card-names {
  font-size: 11px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.day-column .badge,
.day-column .card-group-badge {
  font-size: 9.5px;
  padding: 2px 5px;
}

.span-cell .card-store-name {
  font-size: 12px;
}

.span-cell .card-names {
  font-size: 11px;
}

.span-cell .badge,
.span-cell .card-group-badge {
  font-size: 9.5px;
  padding: 2px 5px;
}

/* 勤怠タブの要対応バッジ（寝坊中＋予定未報告の人数） */
.tab-alert {
  display: inline-block;
  margin-left: 5px;
  min-width: 17px;
  height: 17px;
  line-height: 17px;
  text-align: center;
  border-radius: 999px;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 0 4px;
  vertical-align: 1px;
}

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

/* 勤怠タブ内の「今すぐ更新」 */
.kintai-reload {
  margin-left: 8px;
  border: 1px solid var(--teal);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  cursor: pointer;
}
