/* amagi_shift base styles */
:root {
  --bg: #eef5ef;          /* 画面全体の下地: 薄い緑 */
  --surface: #ffffff;
  --border: #dde7df;      /* 下地に合わせて枠線もわずかに緑寄りに */
  --text: #1f2933;
  --text-muted: #5b6b7d;
  --primary: #2e7dd1;
  --primary-hover: #1f5fa3;
  --danger: #d64545;
  --warn: #d97706;
  --ok: #2f9e64;
  --info: #2c7dd1;
  --shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
/* スティッキーフッター: ホーム画面のみ (body.is-home) で適用。
   body の flex 化はしないで、 main 内コンテンツに最小高さを与えて footer を底に押し下げる方式。 */
body.is-home main.container {
  min-height: calc(100vh - 80px);  /* ヘッダ分を概算で控除 */
  position: relative;
  padding-bottom: 100px;            /* フッター分の余白 */
}
body.is-home .home-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
}

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

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 12px;
  padding-top: 12px;
  padding-bottom: 12px;
  position: relative;
}
.brand {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
}
.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.user-name {
  color: var(--text-muted);
  font-size: 0.9rem;
  white-space: nowrap;
}
/* 権限は氏名の色で表す (マスター=黄 / 店舗管理者=薄青 / 一般=色なし)。
   独立したバッジを出すとヘッダーが横に伸びてしまうため。 */
.user-name.is-master,
.user-name.is-admin {
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 600;
}
.user-name.is-master { background: #fdf3c9; color: #7a5a00; border: 1px solid #ecd98a; }
.user-name.is-admin  { background: #e6f0fa; color: #1e5b96; border: 1px solid #c3daf0; }


/* ナビをボタン状に */
.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border-radius: 8px;
  background: #f7fafc;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.nav-btn:hover {
  background: #e6eef8;
  text-decoration: none;
  border-color: #c8d6e5;
}
.nav-btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.nav-btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}
.nav-btn-danger {
  background: #fff;
  color: var(--danger);
  border-color: #f5b5b5;
}
.nav-btn-danger:hover {
  background: #fdecec;
  color: var(--danger);
}
.nav-btn-pink {
  background: #fce2ec;
  color: #8a3050;
  border-color: #f4a8be;
}
.nav-btn-pink:hover {
  background: #f4a8be;
  color: #fff;
  border-color: #f4a8be;
}
.nav-btn-green {
  background: #d8f0e1;
  color: #15633b;
  border-color: #97d3b1;
}
.nav-btn-green:hover {
  background: #97d3b1;
  color: #fff;
  border-color: #97d3b1;
}
.nav-btn-admin {
  background: #fdf0d2;
  color: #8a5a14;
  border-color: #e8c781;
}
.nav-btn-admin:hover {
  background: #e8c781;
  color: #fff;
  border-color: #e8c781;
}

/* 管理メニュータイル */
.card.admin-section-card {
  padding: 12px 14px;
  margin-bottom: 8px;
}
.card.admin-section-card h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 600;
}
.admin-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin-top: 6px;
}
.admin-tile {
  display: block;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, transform 0.05s, box-shadow 0.15s;
}
.admin-tile:hover {
  border-color: var(--primary);
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(46, 125, 209, 0.15);
}
.admin-tile:active { transform: translateY(1px); }
.admin-tile .tile-icon { font-size: 1.6rem; margin-bottom: 4px; }
.admin-tile .tile-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 4px; }
.admin-tile .tile-desc { color: var(--text-muted); font-size: 0.85rem; line-height: 1.4; }

/* タイル色分け */
.admin-tile.tile-green  { background: #f0faf3; border-color: #b3dcc4; }
.admin-tile.tile-green:hover  { background: #d8f0e1; border-color: var(--ok); box-shadow: 0 4px 12px rgba(47, 158, 100, 0.18); }
.admin-tile.tile-green  .tile-title { color: #15633b; }

.admin-tile.tile-yellow { background: #fff8e6; border-color: #e8c781; }
.admin-tile.tile-yellow:hover { background: #fdf0d2; border-color: #d6a445; box-shadow: 0 4px 12px rgba(214, 164, 69, 0.2); }
.admin-tile.tile-yellow .tile-title { color: #8a5a14; }

.admin-tile.tile-blue   { background: #f0f5fc; border-color: #b9c8e8; }
.admin-tile.tile-blue:hover   { background: #e2eafc; border-color: var(--primary); box-shadow: 0 4px 12px rgba(46, 125, 209, 0.18); }
.admin-tile.tile-blue   .tile-title { color: #1f4097; }

.admin-tile.tile-pink   { background: #fdebf3; border-color: #f0b9d3; }
.admin-tile.tile-pink:hover   { background: #fad0e3; border-color: #d6478e; box-shadow: 0 4px 12px rgba(214, 71, 142, 0.2); }
.admin-tile.tile-pink   .tile-title { color: #a13270; }
.admin-tile.tile-orange { background: #fff3e0; border-color: #f5c79e; }
.admin-tile.tile-orange:hover { background: #ffd9b3; border-color: #d97706; box-shadow: 0 4px 12px rgba(217, 119, 6, 0.2); }
.admin-tile.tile-orange .tile-title { color: #b8521a; }

.admin-tile.tile-red    { background: #fdecea; border-color: #f3b4ad; }
.admin-tile.tile-red:hover    { background: #fbd6d1; border-color: #d32f2f; box-shadow: 0 4px 12px rgba(211, 47, 47, 0.2); }
.admin-tile.tile-red    .tile-title { color: #b3261e; }

/* 店舗の運営 セクションのタイル: タイトル中央寄せ */
.admin-section-store .admin-tile .tile-title { text-align: center; }
.admin-section-store .admin-tile .tile-desc  { text-align: center; }

/* ハンバーガー */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
}
.nav-toggle-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}
.store-tag {
  background: #fff3e0;
  color: #b8521a;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  border: 1px solid #f5c79e;
  font-weight: 600;
  white-space: nowrap;
}
.store-tag.master-tag {
  background: #fdf0d2;
  color: #8a5a14;
  border-color: #e8c781;
}
.store-switch select {
  padding: 4px 8px;
  border: 1px solid #f5c79e;
  border-radius: 999px;
  font-size: 0.85rem;
  background: #fff3e0;
  color: #b8521a;
  font-weight: 600;
}

main { padding: 24px 0 60px; }

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 16px 0;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.85rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}
.card.swap-card {
  padding: 10px 14px;
  margin-bottom: 8px;
}
.card.mypage-card {
  padding: 12px 14px;
  margin-bottom: 8px;
}
.mypage-card h2 { margin: 0 0 6px; font-size: 1rem; }
.mypage-card .table th,
.mypage-card .table td { padding: 6px 10px; font-size: 0.9rem; }
.mypage-card .table th { width: 110px; white-space: nowrap; }
.mypage-card .table td { word-break: break-all; }
.mypage-card .hint { margin: 4px 0; }
.mypage-card details { margin-bottom: 6px; }
.mypage-card .actions { margin-top: 6px; }
.card.swap-card form[hidden] { display: none !important; }

/* リンク化リスト (ホームの交代募集など、行全体タップで遷移) */
.link-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.link-list .link-list-item {
  display: block;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  border-radius: 4px;
}
.link-list .link-list-item:hover {
  background: var(--bg);
  text-decoration: none;
  color: var(--text);
}
.link-list .ll-date {
  font-weight: 600;
  color: var(--primary);
}

/* ホームのシフト交代+お知らせ横並び (PC幅のみ) */
.home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
/* マニュアル / お問い合わせ のボタン列。
   align-items を center にしておくと、 万一 高さのある枠の中に入っても
   ボタンが縦に間延びしない (以前 .home-grid の中に入り込んで縦長になっていた) */
.home-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 24px 0 12px;
  text-align: center;
}
.home-actions > .btn { flex: 0 0 auto; }
@media (min-width: 1024px) {
  .home-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .home-grid > .card { margin-bottom: 0; }
}
.card h1 { margin-top: 0; }
.card h2 { margin-top: 0; }

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.alert-error { background: #fdecec; color: #8a1f1f; border: 1px solid #f5b5b5; }
.alert-info { background: #e6f2fb; color: #1c4f7c; border: 1px solid #b9d9ee; }

.form { display: flex; flex-direction: column; gap: 12px; }
.form[hidden], form[hidden] { display: none !important; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.92rem; color: var(--text-muted); }
.form input[type=text],
.form input[type=email],
.form input[type=password],
.form input[type=date],
.form input[type=time],
.form input[type=number],
.form select,
.form textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
.form textarea { resize: vertical; min-height: 60px; }
.password-wrap {
  position: relative;
  display: block;
}
.password-wrap input {
  width: 100%;
  padding-right: 42px;
}
.password-wrap .pwd-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 6px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.password-wrap .pwd-toggle svg { display: block; }
.password-wrap .pwd-toggle:hover { color: var(--text); }
.password-wrap .pwd-toggle:focus { outline: none; }
.form-foot { margin-top: 12px; font-size: 0.9rem; color: var(--text-muted); }
.login-foot { font-size: 1rem; line-height: 2; }
.login-foot a { font-weight: 600; }
.form label .field-label {
  display: inline;
}
.form label .req {
  font-size: 0.7rem;
  color: var(--danger);
  font-weight: 600;
  margin-left: 4px;
}
.form label .opt {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: 4px;
}
.hint { color: var(--text-muted); font-size: 0.9rem; }

.btn {
  display: inline-block;
  padding: 9px 16px;
  border: 0;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  text-decoration: none;
}
.btn:hover { background: #f0f4f8; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-success { background: #27ae60; color: #fff; border-color: #27ae60; }
.btn-success:hover { background: #1e8449; border-color: #1e8449; color: #fff; }
.btn-purple { background: #8e44ad; color: #fff; border-color: #8e44ad; }
.btn-purple:hover { background: #6c3483; border-color: #6c3483; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b03030; border-color: #b03030; color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 0.85rem; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table th { background: #f7fafc; font-weight: 600; }
.table select, .table input[type="text"], .table input[type="email"], .table input[type="number"] {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
}

/* メンバー一覧 */
.member-table .member-row { cursor: pointer; }
.member-table .member-row:hover { background: #f7fafc; }
.member-table .col-show { width: 42px; white-space: nowrap; text-align: center; padding-left: 4px; padding-right: 4px; }
.member-table .col-emp { width: 90px; white-space: nowrap; }
.member-table .col-emp-type { width: 90px; white-space: nowrap; }
.member-table .btn-unjoin {
  font-size: 0.75rem;
  padding: 3px 8px;
  white-space: nowrap;
  background: #fff;
  color: var(--danger);
  border: 1px solid #f5b5b5;
}
.member-table .btn-unjoin:hover { background: #fdecec; color: var(--danger); }
@media (max-width: 1023px) {
  .member-table .col-email,
  .member-table .col-joined { display: none; }
}
@media (max-width: 700px) {
  .member-table .col-roles { display: none; }
}
@media (max-width: 600px) {
  .member-table .col-emp-type { display: none; }
}

.role-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6em;
  height: 1.6em;
  padding: 0 6px;
  margin: 1px 2px 1px 0;
  border-radius: 4px;
  background: #eef3f8;
  color: #2a4660;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
}

/* 役割トグル(ボタン状) — 2列グリッド */
.role-toggle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 8px;
}
.role-toggle-grid .role-toggle {
  width: 100%;
  justify-content: flex-start;
}
.role-toggle {
  --role-color: #cccccc;
  --role-text: #fff;
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 5px;
  border: 2px solid #d4dae0;
  border-radius: 8px;
  cursor: pointer;
  background: #f3f5f7;
  color: #555;
  user-select: none;
  font-size: 0.88rem;
  white-space: nowrap;
  transition: background-color 120ms, border-color 120ms, color 120ms;
}
.role-toggle > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
/* .form label の flex-direction:column 上書きから守る (specificity 0,2,1) */
.form label.role-toggle {
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 6px;
}
.role-toggle input { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.role-toggle .role-chip {
  background: #fff;
  color: #555;
  border: 1px solid #cfd5db;
}
.role-toggle.is-on {
  background: var(--role-color);
  border-color: var(--role-color);
  color: var(--role-text);
}
.role-toggle.is-on .role-chip {
  background: #fff;
  color: var(--role-color);
  border-color: rgba(255,255,255,0.6);
}

/* 色パレットスウォッチ (24色) */
.role-color-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  max-width: 360px;
  margin-top: 4px;
}
@media (max-width: 600px) { .role-color-grid { grid-template-columns: repeat(8, 1fr); } }
.role-color-swatch {
  display: inline-block;
  cursor: pointer;
}
.role-color-swatch input { position: absolute; opacity: 0; pointer-events: none; }
.role-color-swatch span {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--swatch);
  border: 2px solid transparent;
  border-radius: 4px;
  box-sizing: border-box;
}
.role-color-swatch:hover span { outline: 1px solid #888; }
.role-color-swatch input:checked + span {
  border-color: #222;
  box-shadow: 0 0 0 2px #fff inset;
}

/* color picker button (モーダル用) */
.role-color-swatch-btn {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--swatch);
  border: 2px solid transparent;
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
  box-sizing: border-box;
}
.role-color-swatch-btn:hover { outline: 1px solid #888; }
.role-color-swatch-btn.is-selected {
  border-color: #222;
  box-shadow: 0 0 0 2px #fff inset;
}

/* admin_stores のカード一覧 */
.store-card { border-bottom: 1px solid var(--border, #e1e6ec); }
.store-card:last-child { border-bottom: none; }
.store-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
}
.store-row-info {
  appearance: none;
  background: none;
  border: none;
  padding: 4px 0;
  text-align: left;
  cursor: pointer;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
}
.store-row-info:hover { color: var(--primary); }
.store-row-info code {
  background: #f0f4f8;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
}
.store-row-code {
  display: inline-block;
  min-width: 3.4em;
  padding: 2px 6px;
  background: #fff7ec;
  color: #b06814;
  border: 1px solid #f5d8a8;
  border-radius: 4px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  flex-shrink: 0;
}
.store-row-code:empty { background: #f3f5f7; border-color: #e1e6ec; min-width: 1.2em; }
.store-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
/* 詳細モーダル内: 店舗情報を1行編集 */
.store-info-edit {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 10px;
  margin: 4px 0 8px;
}
.store-info-edit .store-info-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 160px;
  min-width: 0;
  margin: 0;
}
.store-info-edit .store-info-field input {
  padding: 5px 8px;
  border: 1px solid var(--border, #e1e6ec);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  background: #fff;
  width: 100%;
  height: 32px;
  box-sizing: border-box;
}
.store-info-edit .store-info-field-code { flex: 0 1 120px; }
.store-info-hours {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 8px;
}
.store-info-edit:not(.is-editing) .store-info-field input {
  background: #f3f5f7;
  color: #555;
}
/* 編集ボタン (編集モードOFF時の青系) */
.store-info-edit-btn {
  height: 32px;
  min-width: 72px;
  box-sizing: border-box;
  align-self: flex-end;
}
.store-info-edit-btn:not(.btn-primary) {
  background: #1e88e5;
  color: #fff;
  border-color: #1e88e5;
}
.store-info-edit-btn:not(.btn-primary):hover {
  background: #1976d2;
  border-color: #1976d2;
  color: #fff;
}

/* メンバー追加モーダル: 候補リスト */
.add-member-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--border, #e1e6ec);
  border-radius: 6px;
}
.add-member-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border, #e1e6ec);
}
.add-member-item:last-child { border-bottom: none; }
.add-member-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.add-member-info strong { font-weight: 600; }
.add-member-item[hidden] { display: none; }
@media (max-width: 700px) {
  .store-row { flex-wrap: wrap; }
  .store-row-info { flex-wrap: wrap; }
  .store-row-invite { flex-basis: 100%; padding-left: 1.5em; }
  .store-row-actions { margin-left: auto; }
}

/* admin_roles の編集行 */
.role-edit-row {
  border: 1px solid var(--border, #e1e6ec);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
  background: #fafbfc;
  display: block;
}
.role-edit-row .role-edit-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 10px;
}
.role-edit-row .role-edit-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
}
.role-edit-row .role-edit-field input,
.role-edit-row .role-edit-field select {
  padding: 5px 8px;
  border: 1px solid var(--border, #e1e6ec);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  background: #fff;
}
.role-edit-row .role-edit-field-code input,
.role-edit-row .role-edit-field-code select { width: 64px; padding-left: 6px; padding-right: 6px; }
.role-edit-row .role-edit-field-name { flex: 0 1 auto; min-width: 0; }
.role-edit-row .role-edit-field-name input { width: 240px; max-width: 100%; }
.role-edit-row .role-edit-field-order select { width: 70px; }
.role-edit-row .role-edit-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
}
.role-edit-row .role-edit-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
  margin-right: 10px;
}
/* 編集モードでないときはプレビューボタンのカーソルを通常に */
.role-edit-row:not(.is-editing) .role-color-trigger { cursor: default; }
.role-edit-row:not(.is-editing) .role-edit-field input,
.role-edit-row:not(.is-editing) .role-edit-field select { background: #f3f5f7; color: #555; }

/* 編集ボタン (編集モードOFF時の見た目) */
.role-edit-btn:not(.btn-primary) {
  min-width: 72px;
  background: #1e88e5;
  color: #fff;
  border-color: #1e88e5;
}
.role-edit-btn:not(.btn-primary):hover {
  background: #1976d2;
  border-color: #1976d2;
  color: #fff;
}
/* 更新ボタン (btn-primary 付与時) も同じ最小幅で揃える */
.role-edit-btn.btn-primary { min-width: 72px; }
@media (max-width: 1023px) {
  .role-edit-row .role-edit-buttons {
    flex-basis: 100%;
    justify-content: flex-start;
    margin-top: 4px;
  }
}

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.78rem; }
.month-nav .badge { font-size: 0.95rem; padding: 4px 12px; font-weight: 600; }
.badge-want { background: #d8f0e1; color: #15633b; }
.badge-ok { background: #e2eafc; color: #1f4097; }
.badge-ng { background: #fde0e0; color: #8a1f1f; }
.badge-admin { background: #fdf0d2; color: #8a5a14; margin-left: 6px; font-size: 0.7rem; }

.news-unread {
  background: #fce2ec;
}
.news-card {
  padding: 10px 14px;
  margin-bottom: 8px;
  position: relative;
}
.news-card.news-future {
  opacity: 0.7;
  border-left: 4px dashed #e8c781;
}
.news-card .news-link {
  display: block;
  color: inherit;
  text-decoration: none;
}
.news-card .news-link:hover { color: inherit; text-decoration: none; }
.news-card .news-title {
  margin: 0;
  font-size: 1rem;
  color: var(--primary);
}
.news-card .news-meta {
  margin: 4px 0;
  font-size: 0.8rem;
}
.news-card .news-preview {
  margin: 4px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  font-size: 0.9rem;
}
.news-card .news-delete {
  position: absolute;
  top: 8px;
  right: 10px;
}
.news-card.news-link-card .news-link { padding-right: 70px; }
.news-card .news-link { padding-right: 70px; }

/* お知らせ本文の表示 */
.news-body { line-height: 1.7; }
.news-body strong { font-weight: 700; }
.news-body a { color: var(--primary); text-decoration: underline; }
.news-body-preview {
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: #eef0f3;
  min-height: 60px;
  font-size: 0.95rem;
  color: var(--text);
}

/* 本文 + ライブプレビューのレイアウト */
.editor-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
@media (min-width: 1024px) {
  .editor-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: stretch;
  }
  .editor-row textarea { min-height: 240px; }
  .editor-row .news-body-preview { min-height: 240px; }
}

/* 共通モーダル内のlabel/input調整 */
.app-modal-inner label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.app-modal-inner label input[type="text"],
.app-modal-inner label input[type="date"],
.app-modal-inner label input[type="time"],
.app-modal-inner label input[type="datetime-local"],
.app-modal-inner label select,
.app-modal-inner label textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
.app-modal-inner label input:focus,
.app-modal-inner label select:focus,
.app-modal-inner label textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(46, 125, 209, 0.15);
}

/* お知らせ投稿エディタのツールバー */
.editor-toolbar {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.editor-toolbar .tool-btn {
  padding: 5px 12px;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  background: #f7fafc;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
}
.editor-toolbar .tool-btn:hover { background: #e6eef8; }
.editor-toolbar .editor-label {
  align-self: center;
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-right: 4px;
}
.editor-toolbar .editor-hint {
  align-self: center;
  font-size: 0.75rem;
}

/* 日付・日時入力をきれいに */
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"] {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus,
input[type="month"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(46, 125, 209, 0.15);
}

/* 店舗選択画面 */
.store-pick {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}
.store-pick-btn {
  padding: 6px 12px;
  text-align: left;
  font-size: 0.95rem;
  background: #fff;
  border: 1px solid var(--border);
  cursor: pointer;
}
.store-pick-btn:hover {
  background: #d8f0e1;
  border-color: var(--ok);
  color: var(--text);
}
.store-pick-btn[hidden] { display: none !important; }

/* お知らせ投稿: 店舗選択モーダルの3列グリッド */
.store-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-height: 60vh;
  overflow-y: auto;
}
.store-tile {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  background: #fff;
  user-select: none;
}
.store-tile:has(input:checked) {
  background: #d8f0e1;
  border-color: var(--ok);
}
.store-tile input { margin: 0; flex-shrink: 0; }
.store-tile .store-code { color: var(--text-muted); font-size: 0.75rem; }
@media (max-width: 600px) {
  .store-grid { grid-template-columns: repeat(2, 1fr); }
}

/* 既読/未読の2列レイアウト (スマホ幅でも2列維持) */
.read-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.read-col {
  padding: 8px 10px;
  border-radius: 8px;
}
.read-col h4 { margin: 0 0 6px; font-size: 0.9rem; }
.read-col-unread { background: #fce2ec; }
.read-col-unread h4 { color: #8a3050; }
.read-col-read { background: #e2eafc; }
.read-col-read h4 { color: #1f4097; }
.read-chips {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.read-chips li {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.8rem;
  white-space: nowrap;
}
.read-chips .read-time {
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-left: 4px;
}
@media (max-width: 700px) {
  .read-chips .read-clock { display: none; }
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.flex { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--text-muted); }
.right { text-align: right; }

.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 8px;
}
.month-nav h2 { margin: 0; font-size: 1.2rem; }

/* タブレット以下: バーガーメニュー */
@media (max-width: 1024px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 6px 20px rgba(15,23,42,0.12);
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    min-width: 200px;
    max-width: calc(100vw - 32px);
    z-index: 90;
  }
  .nav.active { display: flex; }
  .nav-btn {
    width: 100%;
    justify-content: center;
    padding: 10px 14px;
    font-size: 0.95rem;
  }
}

@media (max-width: 600px) {
  .table th, .table td { padding: 8px 6px; font-size: 0.9rem; }
  .brand { font-size: 1.05rem; }
  .user-name { font-size: 0.8rem; }
}

/* シフト希望ヘッダ + 月ジャンプ */
html { scroll-behavior: smooth; }
.request-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.request-header .month-jump {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.request-header .month-jump .btn {
  padding: 5px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  border: 0;
  transition: filter 0.15s, transform 0.05s;
}
.request-header .month-jump .btn:hover { filter: brightness(1.08); text-decoration: none; color: #fff; }
.request-header .month-jump .btn:active { transform: translateY(1px); }
.request-header .month-jump .btn:nth-child(1) { background: #d6336c; } /* 濃いピンク */
.request-header .month-jump .btn:nth-child(2) { background: #ec6991; } /* 普通ピンク */
.request-header .month-jump .btn:nth-child(3) { background: #f4a8be; color: #8a3050; } /* 薄いピンク */
.request-header .month-jump .btn:nth-child(3):hover { color: #8a3050; }
section.card[id] { scroll-margin-top: 80px; }

/* カレンダーグリッド */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  column-gap: 4px;
  row-gap: 13px;  /* スケジュールバー (3.5px × 3レーン + 1px×2ギャップ = 12.5px) を配置 */
}
.cal-head {
  text-align: center;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 6px 0;
  background: #f7fafc;
  border-radius: 6px;
}
.cal-empty { background: transparent; }
.cal-cell {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 6px;
  min-height: 80px;
  padding: 0;
  font-size: 0.82rem;
  position: relative;
}
.cal-cell .cal-date {
  font-weight: 700;
  font-size: 0.95rem;
}
.cal-cell.dow-sun .cal-date { color: #d32f2f; }
.cal-cell.dow-sat .cal-date { color: #1565c0; }
/* 曜日ヘッダ行: 「日」 は赤、 「土」 は青 */
.cal-grid > .cal-head:nth-child(1) { color: #d32f2f; }
.cal-grid > .cal-head:nth-child(7) { color: #1565c0; }
/* 今日のセル: 右下方向にだけ黄色い影を落とす (持ち上がって見える効果) */
.cal-cell.is-today {
  filter: drop-shadow(2px 2px 2px rgba(253, 216, 53, 0.95)) drop-shadow(1px 1px 1px rgba(253, 216, 53, 0.8));
  z-index: 1;
  position: relative;
}
.cal-cell .cal-holiday {
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  padding: 1px 4px;
  border-radius: 3px;
}
/* 店舗スケジュールバー: セルの 「外側 (上のgap)」 に表示する。
   cal-grid の row-gap (4px) のスキマ部分に絶対配置で重ねる。
   左右も column-gap (4px) を跨ぐので隣のセルのバーと連結。 */
.schbars {
  position: absolute;
  top: -12.5px;       /* row-gap (13px) の中に上から0.5px、 中身は 3.5+1+3.5+1+3.5 = 12.5px */
  left: -3px;         /* 横方向の column-gap (4px) を跨ぐ */
  right: -3px;
  display: flex;
  flex-direction: column;
  gap: 1px;           /* レーン間に隙間 */
  pointer-events: none;
  z-index: 2;
}
.schbar,
.schbar-empty {
  display: block;
  height: 3.5px;      /* バー太さ 1.1倍 (3 → 3.5) */
  width: 100%;
}
.schbar-empty { background: transparent; }
/* 端の日は左右を少し丸める。 中日 (mid-left / mid-right) は丸めない → 連結して見える */
.schbar { border-radius: 1px; }
.schbar.schbar-mid-left  { border-top-left-radius: 0;  border-bottom-left-radius: 0; }
.schbar.schbar-mid-right { border-top-right-radius: 0; border-bottom-right-radius: 0; }

/* スケジュール 月別 legend */
.sched-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 8px 12px;
  font-size: 0.82rem;
}
.sched-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.sched-legend-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sched-legend-range {
  color: var(--text-muted);
  font-size: 0.85em;
  margin-left: 3px;
}

/* 3段レイアウト */
.cal-row {
  width: 100%;
}
.cal-row-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  min-height: 18px;
}
.cal-row-mid {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: clamp(0.6rem, 2.2vw, 0.85rem);
  color: var(--text);
  font-weight: 600;
  padding: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  letter-spacing: -0.02em;
}
.cal-row-mid.time-mid { gap: 2px; }
.cal-row-mid.time-mid .t-start,
.cal-row-mid.time-mid .t-end { white-space: nowrap; }

@media (max-width: 700px) {
  .cal-cell { min-height: 96px; }
  .cal-row-mid.time-mid {
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 0;
    line-height: 1.1;
  }
  .cal-row-mid.time-mid .t-start { text-align: left; padding-left: 2px; }
  .cal-row-mid.time-mid .t-end   { text-align: right; padding-right: 2px; }
}
.cal-row-bot {
  text-align: center;
  font-size: clamp(0.6rem, 2.2vw, 0.7rem);
  color: var(--text-muted);
  min-height: 14px;
  /* 「12人」 などが改行されないよう、 左右余白を最小化して縮小表示 */
  padding: 0 1px;
  white-space: nowrap;
  overflow: hidden;
  letter-spacing: -0.02em;
}
.cal-cell.pref-want { background: #d8f0e1; }
.cal-cell.pref-ok { background: #e2eafc; }
.cal-cell.pref-ng { background: #fde0e0; }
.cal-cell.pref-free { background: #d8f0e1; }
.cal-cell.pref-time { background: #e2eafc; }
.cal-cell.pref-off { background: #fde0e0; }
.cal-cell.pref-undecided { background: #ffe6c2; }
.cal-cell.cal-tap {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  padding: 4px 6px 4px;
  margin: 0;
  width: 100%;
}
.cal-cell.cal-tap:hover { filter: brightness(0.97); }
/* 交代募集モード用 */
.cal-cell.cal-disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }
.cal-cell.cal-swap-eligible { outline: 2px solid #8e24aa; outline-offset: -2px; cursor: pointer; }
.cal-cell.cal-swap-eligible:hover { background: rgba(142,36,170,0.08) !important; }

/* 確定シフトカレンダーのセル */
.assign-cell {
  align-items: stretch;
  text-align: left;
  padding: 4px 6px 6px;
  position: relative;
}
.assign-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 2px;
  flex: 1;
  overflow: hidden;
}
.assign-line {
  font-size: 0.72rem;
  line-height: 1.2;
  padding: 1px 4px;
  background: #eef5fb;
  color: #1565c0;
  border-radius: 3px;
  display: flex;
  justify-content: space-between;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
}
.assign-line .assign-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.assign-line .assign-time { color: #555; font-size: 0.68rem; flex-shrink: 0; }
.assign-line.is-mine { background: #fff3d6; color: #8a5a14; }
.assign-line.is-mine .assign-time { color: #8a5a14; }
.assign-cell.has-mine { box-shadow: inset 0 0 0 2px #f0b94a; }

/* カレンダー各日セルの集計表示 */
.day-counts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  font-size: 0.78rem;
  line-height: 1.2;
}
.day-count {
  padding: 1px 4px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  letter-spacing: -0.02em;
}
.day-count-assigned { background: #e2eafc; color: #1f4097; font-weight: 600; }
.day-count-wish     { background: #fff8d6; color: #8a5a14; }
.day-count-draft    { background: #eceff1; color: #607d8b; font-weight: 600; }

/* セル状態 (背景優先: 確定 > 下書き > 希望 > 交代、 紫線は交代有無で独立) */
.assign-cell.day-mine-wish { background: #e6f4ea; }
.assign-cell.day-mine-assigned { background: #e6f4ea; box-shadow: inset 0 0 0 3px #2e7d32; }
/* 管理者向け: 未確定だがシフト入力済 (下書き) = グレーの点線枠 */
.assign-cell.day-mine-draft { box-shadow: inset 0 0 0 2px #90a4ae; }
.assign-cell.day-mine-draft { background: repeating-linear-gradient(45deg, #fafbfc, #fafbfc 6px, #eceff1 6px, #eceff1 12px); }
.assign-cell.day-swap { background: #f0e9f7; }
/* 交代募集ある: 細い紫線 (内側) */
.assign-cell.day-has-swap { outline: 1.5px solid #7e57c2; outline-offset: -1.5px; }
/* 自分の確定 + 交代募集 が重なる場合: 緑の太枠を活かしつつ 紫線は外側に表示 */
.assign-cell.day-mine-assigned.day-has-swap { outline-offset: 0; }

/* カレンダー凡例 (文字自体を囲む) */
.shifts-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.78rem;
  color: #333;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 3px;
  line-height: 1.4;
}
.legend-item.legend-assigned { background: #e6f4ea; box-shadow: inset 0 0 0 3px #2e7d32; padding: 2px 10px; }
.legend-item.legend-wish     { background: #e6f4ea; }
.legend-item.legend-swap     { background: #f0e9f7; outline: 1.5px solid #7e57c2; outline-offset: -1.5px; }
@media (max-width: 700px) {
  .day-counts .dc-label { display: none; }
  .day-counts .day-count {
    text-align: right;
    /* スマホ幅では枠を詰めて改行を防ぐ。 「12人」 でも 1行で入るように余白を最小化 */
    padding: 1px 2px;
    font-size: clamp(0.62rem, 2.4vw, 0.78rem);
  }
}

/* シフト作成 日ヘッダ */
.day-head-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}
.day-head-center {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.day-head-right { text-align: right; }
@media (max-width: 700px) {
  .day-head-grid { grid-template-columns: 1fr auto; gap: 8px; align-items: start; }
  .day-head-spacer { display: none; }
  .day-head-grid {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }
  .day-head-center {
    justify-content: space-between !important;
    flex-wrap: nowrap;
    gap: 6px !important;
    min-width: 0;
    width: 100%;
  }
  .day-head-center > h2 {
    flex: 0 1 auto;
    font-size: 0.88rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    text-align: center;
  }
  .day-head-center > .btn {
    padding: 4px 10px !important;
    font-size: 0.78rem !important;
    flex-shrink: 0;
    flex-grow: 0;
    white-space: nowrap;
    min-width: max-content;
  }
  .day-head-right {
    flex-direction: column !important;
    align-items: flex-end !important;
    gap: 6px !important;
  }
  .day-head-right .print-btn { display: none !important; }
  /* スマホ幅では day-head-right (印刷ボタンだけ残る) を非表示にし、 戻るボタンは center 内に */
  .day-head-right { display: none !important; }
  .holiday-name { display: none; }
}
/* 「月カレンダーに戻る」 → スマホ幅で「戻る」 (default は長文表示) */
.back-btn .back-text-short { display: none; }
@media (max-width: 700px) {
  .back-btn .back-text-long { display: none; }
  .back-btn .back-text-short { display: inline; }
}
/* 戻るボタンは PC でもスマホでも day-head-center の右端に inline 配置 */
.back-btn-inline { display: inline-flex; }

/* 拡大表示ボタン: ブラウザ幅問わず 常に 左下に表示 */
.fullscreen-btn {
  position: fixed;
  left: 12px;
  bottom: 12px;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: 50%;
  background: rgba(255,255,255,0.96);
  color: #333;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0,0,0,0.22);
  padding: 0;
  z-index: 998;
  display: flex;
}
.fullscreen-btn:active { background: rgba(237,138,42,0.18); }

/* フルスクリーン横向きモーダル */
.fullscreen-modal {
  position: fixed; inset: 0;
  background: #1a1a1a;
  z-index: 9999;
  overflow: hidden;
}
.fullscreen-close {
  position: fixed; top: 12px; right: 12px;
  width: 44px; height: 44px;
  border: none; background: rgba(255,255,255,0.95); color: #222;
  border-radius: 50%; font-size: 1.7rem; line-height: 1;
  cursor: pointer; z-index: 10001;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.fullscreen-stage {
  width: 100%; height: 100%;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  touch-action: none;
  background: #1a1a1a;
}
.fullscreen-content {
  transform-origin: center center;
  background: #fff;
  will-change: transform;
}
.fullscreen-content .card.dayplan-scroll {
  max-height: none !important;
  overflow: visible !important;
  box-shadow: none;
  background: #fff;
}
/* モーダル内ではメンバー名列・ヘッダの sticky を解除 (回転後にずれて表示される問題対策) */
.fullscreen-content .dayplan-name,
.fullscreen-content .dayplan-header,
.fullscreen-content .dayplan-counts-row {
  position: static !important;
  left: auto !important;
  top: auto !important;
}
@media print {
  .fullscreen-btn, .fullscreen-modal { display: none !important; }
}

/* シフト作成 1日分: スクロールコンテナ (縦・横両方ここで発生 → sticky が効く) */
.card.dayplan-scroll {
  overflow: auto;
  max-height: calc(100vh - 200px);
}
@media (max-width: 700px) {
  .card.dayplan-scroll { max-height: calc(100vh - 160px); }
}

/* 印刷用 (A4 横) — assign_day を 1ページに収める */
@media print {
  @page { size: A4 landscape; margin: 5mm; }
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  html, body { background: #fff !important; }
  body .container { max-width: none !important; padding: 0 !important; }
  .site-header, .nav, .no-print, .role-palette, .dayplan-name-roles,
  .bar-handle, .day-head-right, footer { display: none !important; }
  .card { box-shadow: none !important; border: none !important; padding: 0 !important; margin: 0 0 2mm !important; background: transparent !important; }
  .card.dayplan-scroll { max-height: none !important; overflow: visible !important; }

  /* ガントチャートを 30人 でも A4 横 1枚 に収まるサイズに */
  /* CSS変数は inline style と同じ specificity なので !important で強制 */
  .dayplan {
    --name-w: 175px !important;   /* 漢字6文字 + 確定時間 */
    --slot-w: 26px !important;    /* 右の余裕分すこし拡大 */
    --row-h: 18px !important;
    font-size: 0.7rem;
    /* 左に30分分(1スロット)の余白を確保し、そこから左揃え */
    width: max-content !important;
    margin-left: calc(var(--slot-w) * 1) !important;
    margin-right: 0 !important;
  }
  .dayplan-row { min-height: var(--row-h) !important; }
  .dayplan-name { padding: 0 4px !important; gap: 4px !important; height: var(--row-h) !important; }
  .dayplan-name-strong { font-size: 0.74rem !important; }
  /* メンバー行の氏名のみ 6文字までに制限 + JS で scaleX 縮小 (ヘッダ「メンバー」は除外) */
  .dayplan-row.row-free .dayplan-name-strong,
  .dayplan-row.row-time .dayplan-name-strong,
  .dayplan-row.row-off .dayplan-name-strong,
  .dayplan-row.row-undecided .dayplan-name-strong,
  .dayplan-row.row-none .dayplan-name-strong {
    display: inline-block !important;
    max-width: 6em !important;        /* 漢字6文字相当 */
    white-space: nowrap !important;
    transform-origin: left center;
  }
  .dayplan-confirmed { font-size: 0.66rem !important; flex: 0 0 8.5em !important; white-space: nowrap !important; }
  .dayplan-header .dayplan-confirmed { display: none !important; }
  .dayplan-slot-head { font-size: 0.62rem !important; line-height: var(--row-h) !important; }
  .dayplan-hour-label { font-size: 0.68rem !important; }
  .dayplan-bar {
    color: #fff !important;
    font-size: 0.72rem !important;
    top: 1px !important;
    bottom: 1px !important;
    padding: 0 3px !important;
    border-radius: 2px !important;
  }
  .dayplan-bar .bar-time { font-size: 0.62rem !important; }
  .dayplan-bar .bar-role { font-size: 0.82rem !important; margin-right: 2px !important; }
  .dayplan-header { background: #efefef !important; height: var(--row-h) !important; }
  /* 印刷時は 自分行の緑背景を消す (specificity を上げて通常ruleに勝つ) */
  .dayplan .dayplan-row.is-me { background: transparent !important; }
  /* メンバー名がある行 (row-free/time/off/undecided/none) のみ 10% 高く */
  .dayplan-row.row-free,
  .dayplan-row.row-time,
  .dayplan-row.row-off,
  .dayplan-row.row-undecided,
  .dayplan-row.row-none {
    min-height: calc(var(--row-h) * 1.1) !important;
  }
  .dayplan-row.row-free .dayplan-name,
  .dayplan-row.row-time .dayplan-name,
  .dayplan-row.row-off .dayplan-name,
  .dayplan-row.row-undecided .dayplan-name,
  .dayplan-row.row-none .dayplan-name {
    height: calc(var(--row-h) * 1.1) !important;
  }
  /* 印刷: 行下と毎時の縦線をほぼ黒に。 30分の縦線は薄く目立たない程度 */
  .dayplan-row { border-bottom: 1px solid #2a2a2a !important; }
  .dayplan-slot { border-right: 1px solid #d8d8d8 !important; }   /* 30分は薄め */
  .dayplan-slot.is-hour { border-right: 1px solid #2a2a2a !important; }  /* 毎時は黒 */
  /* 氏名列と時間軸の境界線: トラックに左borderを引く (box-sizing: border-box で 幅が広がらないように) */
  .dayplan-name { border-right: 0 !important; }
  .dayplan-track {
    border-left: 1px solid #2a2a2a !important;
    box-sizing: border-box !important;
  }
  /* 希望時間帯の黄色ハイライトを印刷でも維持 */
  .dayplan-wish { background: rgba(255, 224, 102, 0.6) !important; }
  .day-head-grid h2 { font-size: 0.92rem !important; }
  .day-head-spacer, .day-head-center > a { display: none !important; }
  .day-head-grid { grid-template-columns: 1fr !important; }

  /* sticky 解除 — 印刷では sticky がブラウザ(特に Edge / Firefox)で誤動作してページ下部に飛ぶことがある */
  .dayplan-counts-row,
  .dayplan-header,
  .dayplan-name { position: static !important; }
}

/* シフト作成 — 1日分のガントチャート風レイアウト */
.dayplan {
  --name-w: 140px;
  --slot-w: 28px;
  --row-h: 36px;
  --slot-count: 36;
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  min-width: calc(var(--name-w) + var(--slot-w) * var(--slot-count));
}
.dayplan-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border, #e1e6ec);
  min-height: var(--row-h);
}
.dayplan-row:last-child { border-bottom: none; }
.dayplan-row.row-free { background: #f6fbf7; }
.dayplan-row.row-time { background: #f5f8fc; }
.dayplan-row.row-off  { background: #fef4f4; color: #8a8a8a; }
.dayplan-row.row-none { background: #fafbfc; color: #888; }
/* 希望未提出でも 確定シフトが入っていれば 名前は通常色に戻す (グレーアウト解除) */
.dayplan-row.row-none:not(.dayplan-row-empty) .dayplan-name,
.dayplan-row.row-none:not(.dayplan-row-empty) .dayplan-name-strong { color: var(--text); }
.dayplan-row.row-undecided { background: #fff6ea; }

/* 確定シフトなし・希望のみメンバーの細い行 (印刷ガント下部にくっつけて表示) */
.dayplan-row.dayplan-row-wish {
  min-height: 0;
  background: #fbfdf9;
}
.dayplan-row.dayplan-row-wish .dayplan-name { gap: 3px; }
.dayplan-wishrole {
  display: inline-block;
  padding: 0 4px;
  border-radius: 2px;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.5;
  flex-shrink: 0;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* シフトコメント行 — 通常画面では非表示、 拡大モーダル / 印刷でのみ表示 */
.dayplan-note-row { display: none; }
.fullscreen-content .dayplan-note-row { display: flex; }
@media print { .dayplan-note-row { display: flex; } }
.dayplan-note-row .dayplan-name { background: transparent; }
.dayplan-note-row .dayplan-track { min-height: 22px; }
/* 拡大モーダル: コメント行の高さは メンバー行の 2/3、 ●! マークも非表示 */
.fullscreen-content .dayplan-note-row {
  min-height: calc(var(--row-h) * 2 / 3) !important;
}
.fullscreen-content .dayplan-note-row .dayplan-name {
  height: calc(var(--row-h) * 2 / 3) !important;
  min-height: 0 !important;
}
.fullscreen-content .dayplan-note-row .dayplan-track {
  min-height: calc(var(--row-h) * 2 / 3) !important;
}
.fullscreen-content .bar-note-mark { display: none !important; }
/* 印刷時の調整 (拡大表示は無変更) */
.dayplan-roles-stack-row { display: none; }
@media print {
  /* コメント: 上寄せ + 右はみ出しOK + 小さめフォント (衝突時はJSで scaleX 縮小) */
  .dayplan-note-item {
    top: 0;
    padding: 0 3px;
    font-size: 8px;
    line-height: 10px;
    width: auto !important;        /* バー幅の制限を解除 */
    max-width: none !important;
    overflow: visible !important;  /* 右にはみ出る */
    text-overflow: clip;
    white-space: nowrap;
    transform-origin: left center;
    z-index: 2;                    /* 上の行のバーに隠れないように */
    background: #fff !important;   /* 文字の背景は白 (罫線・希望色と被らないように) */
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  /* 行高はデフォルト (--row-h = 18px) のまま — 上寄せは line-height で実現 */

  .bar-note-mark { display: none !important; }          /* 赤丸! は印刷では不要 */
  .dayplan-name-strong { text-decoration: none !important; } /* 氏名の下線 (mcal-open) を消す */
  .dayplan-row-empty { display: none !important; }      /* 確定シフトなしの行は印刷しない */

  /* 確定なし・希望のみ: ガント下部に細い行で表示 (row-free/time の高さ指定に勝つよう後置) */
  .dayplan-row.dayplan-row-wish {
    min-height: calc(var(--row-h) * 0.72) !important;
    background: #f3f8f0 !important;
  }
  .dayplan-row.dayplan-row-wish .dayplan-name {
    height: calc(var(--row-h) * 0.72) !important;
    min-height: 0 !important;
    gap: 3px !important;
  }
  .dayplan-row.dayplan-row-wish .dayplan-name-strong {
    font-size: 0.62rem !important;
    max-width: 6em !important;
  }
  .dayplan-row.dayplan-row-wish .dayplan-wishlabel {
    font-size: 0.56rem !important;
    flex: 0 0 6.5em !important;
  }
  .dayplan-row.dayplan-row-wish .dayplan-wishrole {
    font-size: 0.52rem !important;
    padding: 0 3px !important;
    line-height: 1.4 !important;
  }
  .dayplan-row.dayplan-row-wish-first { border-top: 1.5px solid #2a2a2a !important; }

  /* 役割別 積み重ね行 (印刷時のみ表示) */
  .dayplan-roles-stack-row { display: flex !important; }
  /* 役割stack行 / コメント行 の氏名列を 親行の高さに揃える (右borderが途中で途切れないよう) */
  .dayplan-roles-stack-row .dayplan-name { background: transparent !important; height: auto !important; align-self: stretch !important; min-height: 100% !important; }
  .dayplan-note-row .dayplan-name { background: transparent !important; align-self: stretch !important; min-height: 100% !important; height: auto !important; }
  .dayplan-roles-stack-row .role-stack-slot {
    display: flex;
    flex-direction: column-reverse;     /* B が下、 E が上に積み重なる */
    align-items: stretch;
    justify-content: flex-start;        /* column-reverse なので start = 下寄せ */
    padding: 0 1px;
    gap: 1px;
    min-height: 0;
    line-height: 1;
  }
  .role-stack-box {
    box-sizing: border-box;
    border: 1.2px solid currentColor;
    border-radius: 2px;
    font-size: 8px;
    font-weight: 700;
    line-height: 1;
    padding: 1px 0;
    text-align: center;
    background: #fff;
    min-height: 10px;
  }
}
.dayplan-note-item {
  position: absolute;
  top: 2px;
  padding: 1px 4px;
  font-size: 0.78rem;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
/* シフトバー右上のコメント有りマーク (赤丸+!) */
.dayplan-bar .bar-note-mark {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #d32f2f;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  font-family: sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
  z-index: 1;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.dayplan-row.is-me    { background: #e6f4ea !important; }
.dayplan-header {
  position: sticky;
  top: 24px; /* 集計行 24px の下に重ねる */
  z-index: 4;
  background: #f3f5f7;
  font-weight: 600;
  border-bottom: 2px solid var(--border, #d4dae0);
  min-height: 28px !important;
  height: 28px !important;
}
.dayplan-header .dayplan-slot-head { line-height: 28px !important; }

/* 集計ブロック: 役割別稼働時間/人件費 + 売上予算 + 人件費率 (dayplan の外側に独立配置) */
.card.money-summary {
  padding: 8px 12px;
  background: #fffbe6;
}
.money-summary-body {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.money-summary-title {
  font-size: 0.85rem;
  color: #8a5a14;
  font-weight: 700;
  margin-right: 4px;
}
.money-summary-title-btn {
  background: transparent;
  border: 1.5px solid #8a5a14;
  border-radius: 6px;
  padding: 3px 12px;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.1;
}
.money-summary-title-btn:hover { background: rgba(138, 90, 20, 0.08); }

.money-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.money-summary-table th,
.money-summary-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border, #e1e6ec);
  text-align: left;
  vertical-align: middle;
  font-weight: normal;
}
.money-summary-table th { color: var(--text-muted, #5b6b7d); width: 40%; }
.money-summary-table td { font-weight: 600; text-align: right; white-space: nowrap; }
.money-summary-table tr:last-child th,
.money-summary-table tr:last-child td { border-bottom: none; }

/* シフト希望履歴リスト (request モーダル内) */
.req-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 60vh;
  overflow-y: auto;
  font-size: 0.88rem;
}
.req-history-list .rqh-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 6px;
  border-bottom: 1px solid #eee;
  flex-wrap: wrap;
}
.req-history-list .rqh-row:last-child { border-bottom: none; }
.req-history-list .rqh-date {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-size: 0.85em;
  white-space: nowrap;
  flex: 0 0 5.5em;
}
.req-history-list .rqh-text { flex: 1 1 auto; min-width: 0; line-height: 1.4; }
.req-history-list .rqh-text .rqh-meta {
  color: var(--text-muted);
  font-size: 0.88em;
  margin-left: 4px;
}
.req-history-list .rqh-row-self { background: #f5f8fc; }
.req-history-list .rqh-row-admin { background: #fffaf0; }
.req-history-list .rqh-row-admin .rqh-text::before { content: '⚙ '; color: #8a5a14; font-weight: 700; }

/* 当日の店舗スケジュール (該当日にかかる予定の一覧) */
.day-sched-row,
.day-sched-print { display: none; }
/* 拡大表示時のみ表示 (gantt 内、 人数行の上) */
.fullscreen-content .day-sched-row-fullscreen {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 6px 10px;
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.day-sched-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.day-sched-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.day-sched-range { color: var(--text-muted); font-size: 0.9em; }
@media print {
  /* 印刷時のみ 集計の上に大きめの字で並べる */
  .day-sched-print {
    display: flex !important;
    flex-wrap: wrap;
    gap: 6px 20px !important;
    padding: 2mm 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    font-size: 12px;
    font-weight: 700;
    break-inside: avoid;
  }
  .day-sched-print .day-sched-dot { width: 12px; height: 12px; }
  .day-sched-print .day-sched-range { font-weight: 500; }
  /* 拡大用ブロックは印刷では非表示 (印刷専用版が別に出るため) */
  .day-sched-row-fullscreen { display: none !important; }
}

/* 印刷専用: シフトの下に右寄せで表示する集計サマリ */
.print-only-summary { display: none; }

/* 「希望シフト」リスト (常時定義 — 印刷時は print-only-summary が表示される) */
.print-wishonly-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px 6px;
}
.print-wishonly-list li {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 4px;
  padding: 2px 5px;
  border: 1px solid #2a2a2a;
  border-radius: 3px;
  overflow: hidden;
  font-size: 9px;
}
.print-wishonly-list .pwo-role {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.4;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.print-wishonly-list .pwo-name { font-weight: 600; white-space: nowrap; }
.print-wishonly-list .pwo-time { color: #333; font-variant-numeric: tabular-nums; white-space: nowrap; }
.print-wishonly-h { margin: 0 0 3px; font-size: 11px; font-weight: 700; color: #333; }

@media print {
  .print-only-summary {
    display: block !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 2mm 0 0 !important;
    break-inside: avoid;
  }
  .print-summary-wrap {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 6mm;
    flex-wrap: wrap;
  }
  /* 3セクションを横並びに */
  .print-summary-table.psum-block {
    flex: 0 0 auto;
    align-self: stretch;
  }
  /* ボトム: 左に「希望のみ」、 右に集計 */
  .print-bottom-wrap {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8mm;
  }
  .print-bottom-wrap .print-summary-wrap { flex: 0 0 auto; }
  .print-wishonly-box {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 9px;
    line-height: 1.3;
  }
  .print-wishonly-h {
    margin: 0 0 2px;
    font-size: 10px;
    color: #333;
    font-weight: 700;
  }
  /* (wishOnly のスタイルは @media print の外に定義済み — 印刷でもそのまま使われる) */
  .print-summary-table {
    border-collapse: collapse;
    font-size: 12px;
    line-height: 1.3;
    border: 1px solid #aaa;
  }
  .print-summary-table th,
  .print-summary-table td {
    padding: 3px 10px;
    border-bottom: 1px solid #ddd;
    font-weight: normal;
    text-align: left;
    white-space: nowrap;
  }
  .print-summary-table td { text-align: right; font-weight: 600; }
  .print-summary-table tr:last-child th,
  .print-summary-table tr:last-child td { border-bottom: none; }
  .print-summary-table .psum-section {
    background: #efeae0;
    color: #6a4810;
    font-weight: 700;
    text-align: left;
    padding: 3px 10px;
    font-size: 15px;
  }
  .print-summary-table .psum-role {
    display: inline-block;
    border-radius: 2px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 700;
    margin-right: 4px;
    vertical-align: middle;
  }
}
.money-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #fff;
  border: 1px solid #d4dae0;
  font-size: 0.78rem;
  white-space: nowrap;
}
.money-chip.money-total { background: #2a2a2a; color: #fff; border-color: #2a2a2a; }
.money-chip.money-revenue { background: #e2eafc; color: #1f4097; border-color: #c5d0eb; }
.money-chip.money-ratio { background: #eef7e9; color: #2e7d32; border-color: #b7d6b3; }
.money-chip.money-ratio.is-high { background: #fde0e0; color: #8a1f1f; border-color: #f0b9b9; }

/* 集計行: 各時の稼働人数 */
.dayplan-counts-row {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #eef7e9;
  min-height: 24px !important;
  height: 24px !important;
  border-bottom: 1px solid var(--border, #d4dae0);
  font-size: 0.72rem;
  color: #2e7d32;
}
.dayplan-counts-row .dayplan-name {
  height: 24px !important;
  background: #eef7e9 !important;
  font-size: 0.72rem;
  color: #2e7d32;
  font-weight: 600;
  justify-content: flex-end !important;  /* 「人数」を右寄せ */
  padding-right: 8px !important;
}
.dayplan-count-slot {
  width: var(--slot-w);
  flex-shrink: 0;
  border-right: 1px solid #eef0f3;
  position: relative;
  line-height: 24px;
  text-align: center;
  font-size: 0.7rem;
}
.dayplan-count-slot.is-hour { border-right-color: #c9d0d8; }
.dayplan-count-num { font-weight: 700; }
.dayplan-name {
  width: var(--name-w);
  flex-shrink: 0;
  padding: 5px 6px;
  border-right: 1px solid var(--border, #e1e6ec);
  background: inherit;
  position: sticky;
  left: 0;
  z-index: 3;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  line-height: 1.15;
  min-width: 0;
}
.dayplan-name-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.dayplan-name-strong {
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dayplan-confirmed {
  font-size: 0.82rem;
  color: #1565c0;
  font-weight: 700;
  white-space: nowrap;
  flex: 0 0 8.5em;
  text-align: right;
}
.dayplan-header .dayplan-confirmed {
  font-size: 0.66rem;
  color: #6c757d;
  font-weight: 500;
  flex: 0 0 auto;
}
.dayplan-name-roles {
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  overflow: hidden;
  min-width: 0;
}
.dayplan-name-roles .role-chip {
  margin: 0;
  font-size: 0.65rem;
  padding: 0 3px;
  min-width: 1.2em;
  height: 1.2em;
}
.dayplan-name-roles .role-chip-unused { opacity: 0.3; }
.dayplan-track {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  cursor: pointer;
  width: calc(var(--slot-w) * var(--slot-count));
}
.dayplan-track:hover { background: rgba(237,138,42,0.04); }
/* ヘッダ行 (時間目盛り) と 集計人数行 の track はクリック領域ではないので指マークを出さない */
.dayplan-header .dayplan-track,
.dayplan-counts-row .dayplan-track { cursor: default; }
.dayplan-header .dayplan-track:hover,
.dayplan-counts-row .dayplan-track:hover { background: transparent; }
.dayplan-count-slot.is-clickable { cursor: pointer; }
.dayplan-count-slot.is-clickable:hover { background: rgba(46,125,50,0.12); }
.dayplan-slot {
  width: var(--slot-w);
  flex-shrink: 0;
  border-right: 1px solid #eef0f3;
  position: relative;
  z-index: 1;        /* 希望ハイライト (z-index:0) より前に置いて 縦線が見えるように */
}
.dayplan-slot.is-hour { border-right-color: #c9d0d8; }
.dayplan-slot-head {
  font-size: 0.7rem;
  color: #888;
  text-align: left;
  padding-left: 2px;
  line-height: var(--row-h);
}
.dayplan-hour-label { color: #333; font-weight: 600; }
/* 希望時間帯のハイライト (薄い黄色) */
.dayplan-wish {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(255, 224, 102, 0.4);
  border: none;
  pointer-events: none;
  z-index: 0;        /* 罫線・バーより下に。 スロットの縦線が見えるように */
}
/* 管理者向け: 休み希望の理由 (トラック左端に表示) */
.dayplan-off-reason {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.78rem;
  font-weight: 600;
  color: #c62828;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 12px);
  pointer-events: none;
  z-index: 2;
}
/* 希望未提出: グレーで控えめに */
.dayplan-off-reason.dayplan-unsubmitted {
  color: #999;
  font-weight: 500;
}
/* 確定シフトのバー */
.dayplan-bar {
  position: absolute;
  top: 8px;
  bottom: 8px;
  background: #1e88e5;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 2;
  font-family: inherit;
}
.dayplan-bar:hover { filter: brightness(0.92); }
.dayplan-bar .bar-time { font-size: 0.7rem; opacity: 0.9; }
.dayplan-bar .bar-role { font-size: 0.85rem; font-weight: 700; margin-right: 4px; }
.dayplan-bar.is-temp { opacity: 0.65; pointer-events: none; }
.dayplan-row.role-ineligible { opacity: 0.45; }
.dayplan-row.role-ineligible .dayplan-track { cursor: not-allowed; }

/* バーの両端ハンドル (時間調整) */
.bar-handle {
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 5px;
  background: rgba(255,255,255,0.85);
  border-radius: 1px;
  cursor: ew-resize;
  touch-action: none;
}
.bar-handle-left { left: 2px; }
.bar-handle-right { right: 2px; }
.bar-handle:hover { background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.15); }
.dayplan-bar.is-resizing { z-index: 5; box-shadow: 0 0 0 2px rgba(0,0,0,0.2); }

/* 役割パレット */
.role-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.palette-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  border: 2px solid #d4dae0;
  border-radius: 6px;
  background: #f3f5f7;
  color: #555;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.86rem;
  user-select: none;
}
.palette-btn:hover { border-color: #aab2bc; }
.palette-btn.is-active {
  background: var(--role-color, #1e88e5);
  border-color: var(--role-color, #1e88e5);
  color: var(--role-text, #fff);
}
.palette-btn[data-role-id=""].is-active {
  background: #555;
  border-color: #555;
  color: #fff;
}
.palette-btn-compact {
  padding: 3px;
  gap: 0;
}
/* 役割コード単独ボタン (B/S/P/E) */
.palette-btn-code {
  min-width: 3em;
  padding: 5px 14px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: #fff;
  color: var(--role-color);
  border: 2px solid var(--role-color);
  justify-content: center;
  text-align: center;
}
.palette-btn-code:hover { background: color-mix(in srgb, var(--role-color) 12%, #fff); }
.palette-btn-code.is-active {
  background: var(--role-color);
  color: var(--role-text);
  border-color: var(--role-color);
}
.history-btn {
  font-size: 1.05rem;
  line-height: 1;
  padding: 4px 10px;
  background: #fff;
  color: #444;
  border: 2px solid #d4dae0;
  border-radius: 6px;
  font-family: inherit;
  cursor: pointer;
}
.history-btn:hover:not(:disabled) { background: #f3f5f7; border-color: #aab2bc; }
.history-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ロック状態 (確定済み or 締切過ぎ) — はっきりグレーアウト */
.cal-cell:disabled,
.cal-cell.cal-assigned,
.cal-cell.cal-past-deadline {
  background: #e2e6eb !important;
  color: #9aa3ad !important;
  cursor: not-allowed !important;
  opacity: 0.7;
  filter: none !important;
  position: relative;
}
.cal-cell:disabled:hover,
.cal-cell.cal-assigned:hover,
.cal-cell.cal-past-deadline:hover { filter: none !important; }
.cal-cell.cal-assigned .cal-date,
.cal-cell.cal-past-deadline .cal-date { color: #8a929b !important; }
/* 斜線オーバーレイで「無効」感を強調 */
.cal-cell.cal-assigned::before,
.cal-cell.cal-past-deadline::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    135deg,
    transparent 0,
    transparent 6px,
    rgba(0,0,0,0.05) 6px,
    rgba(0,0,0,0.05) 12px
  );
  pointer-events: none;
  border-radius: inherit;
}
/* 右上の鍵 / チェックアイコン */
.cal-lock-mark {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.78rem;
  color: #6b7480;
  line-height: 1;
}
.cal-cell.cal-selected { outline: 3px solid var(--ok); outline-offset: -3px; background: #d8f0e1 !important; }
.cal-edit { padding: 8px 6px; display: flex; flex-direction: column; gap: 6px; }
.cal-edit-row { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.cal-edit-row label { font-size: 0.78rem; }
.cal-edit input[type=time] { padding: 4px 6px; border: 1px solid var(--border); border-radius: 5px; font-size: 0.8rem; }

@media (max-width: 720px) {
  .cal-cell { min-height: 56px; font-size: 0.75rem; }
  .cal-cell .cal-date { font-size: 0.85rem; }
  .badge { font-size: 0.7rem; padding: 1px 5px; }
}

/* PWAインストールボタン(ナビ内) */
.nav-install {
  font-size: 0.85rem;
  white-space: nowrap;
}
.nav-install[hidden] { display: none !important; }
/* スタンドアロン(=PWAアプリ起動)中はナビのインストールボタンを必ず隠す */
@media (display-mode: standalone) {
  .nav-install { display: none !important; }
}

/* 共通通知/確認モーダル */
.app-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 16px;
  animation: appModalFade 0.15s ease-out;
}
.app-modal[hidden] { display: none !important; }
@keyframes appModalFade {
  from { background: rgba(15, 23, 42, 0); }
  to   { background: rgba(15, 23, 42, 0.55); }
}
.app-modal-inner {
  background: #fff;
  border-radius: 12px;
  padding: 20px 22px;
  width: 100%;
  max-width: 380px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.3);
  animation: appModalPop 0.18s ease-out;
  position: relative;
}
@keyframes appModalPop {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.app-modal-msg {
  margin: 0 0 16px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
}
.app-modal-msg.kind-info { color: var(--text); }
.app-modal-msg.kind-error { color: var(--danger); }
.app-modal-msg.kind-confirm { color: var(--text); }
.app-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* シフト希望入力モーダル */
.shift-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}
.shift-modal[hidden] { display: none !important; }
.shift-modal-inner {
  background: #fff;
  border-radius: 12px;
  padding: 20px 22px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.3);
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: transparent;
  border: 0;
  font-size: 1.6rem;
  line-height: 1;
  width: 36px;
  height: 36px;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 8px;
}
.modal-close:hover { color: var(--text); background: #f0f4f8; }
.shift-modal-inner h3 { margin: 0 0 4px; }
.seg-tabs {
  display: flex;
  gap: 4px;
  background: #f0f4f8;
  padding: 3px;
  border-radius: 999px;
}
.seg-tab {
  flex: 1;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}
.seg-tab.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.shift-modal-inner select,
.shift-modal-inner input[type="text"] {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  width: 100%;
}
.modal-block {
  min-height: 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.modal-block[hidden] { display: none; }
.shift-modal-inner #modalDelete {
  background: transparent;
  color: var(--danger);
  border: 1px solid #f5b5b5;
}
.shift-modal-inner #modalDelete:hover {
  background: #fdecec;
  color: var(--danger);
}
.shift-modal-inner #modalDup {
  background: var(--ok);
  color: #fff;
  border: 1px solid var(--ok);
}
.shift-modal-inner #modalDup:hover {
  background: #258050;
  border-color: #258050;
  color: #fff;
}

/* 複製モード */
.copy-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--ok);
  color: #fff;
  padding: 10px 16px;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 110;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}
.copy-banner[hidden] { display: none !important; }
.copy-fab[hidden] { display: none !important; }
.copy-banner .btn {
  background: #fff;
  color: var(--ok);
  border: 0;
}
body.copy-mode-on { padding-top: 50px; }
.copy-fab {
  position: fixed;
  right: 20px;
  bottom: 24px;
  background: var(--ok);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(47, 158, 100, 0.4);
  z-index: 100;
  font-size: 0.82rem;
  border: 0;
  font-family: inherit;
}
.copy-fab:hover { filter: brightness(1.05); }
body.copy-mode-on .cal-tap { cursor: copy; }

/* インストールガイドモーダル */
.install-modal {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}
.install-modal-inner {
  background: #fff;
  border-radius: 10px;
  padding: 20px 22px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 12px 32px rgba(15,23,42,0.25);
}
.install-modal-inner h3 { margin-top: 0; }
.install-modal-inner ol { padding-left: 20px; line-height: 1.8; }
.install-modal-inner .btn { margin-top: 12px; }

/* マスター権限管理 — 1行1ユーザーのコンパクト一覧 */
.master-user-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.master-user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.master-user-row .master-user-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 4px 6px;
  cursor: pointer;
  text-align: left;
  min-width: 0;
  font: inherit;
  color: inherit;
}
.master-user-row .master-user-info:hover { background: #f4f6f8; border-radius: 6px; }
.master-user-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.master-user-role {
  flex: 0 0 auto;
  margin: 0;
}
.master-user-role select.role-select {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  background: #fff;
  min-width: 110px;
}

/* シフト希望モーダル: 管理者の「予定」 */
.plan-view[hidden], .plan-edit[hidden] { display: none; }
.plan-view {
  background: var(--bg);
  border-radius: 6px;
  padding: 8px 10px;
}
.plan-view-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #888;
  margin-bottom: 4px;
}
.plan-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  font-size: 0.9rem;
  padding: 3px 0;
}
.plan-item + .plan-item { border-top: 1px solid #e5e9ee; }
.plan-badge {
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 10px;
  background: #e0e4e8;
  color: #555;
  white-space: nowrap;
}
.plan-badge-pub { background: #d6e9ff; color: #1f4097; }
.plan-body { flex: 1; min-width: 0; word-break: break-word; }
.plan-author { font-size: 0.78rem; color: #999; }
.plan-edit {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
}
.plan-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
}
.plan-label input {
  width: 100%;
  margin-top: 4px;
}

/* シフト期間バッジの内側に出す提出状況 (済/未) */
.submit-status {
  display: inline-block;
  margin-left: 5px;
  padding: 0 5px;
  border-radius: 8px;
  background: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: middle;
  white-space: nowrap;
}
.submit-done { color: #1e8449; }
.submit-undone { color: #c0392b; }

/* 使い方ツアー */
.tour-start-btn {
  margin-left: 10px;
  padding: 3px 11px;
  font-size: 0.8rem;
  font-family: inherit;
  border: 1px solid #e8d68a;
  border-radius: 12px;
  background: #fcf2c4;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.tour-start-btn:hover { background: #f7e9a6; }
.tour-blocker {
  position: fixed;
  inset: 0;
  z-index: 9990;
}
.tour-blocker-dim { background: rgba(0,0,0,.55); }
.tour-spot {
  box-shadow: 0 0 0 4px #4f8fd6, 0 0 0 9999px rgba(0,0,0,.55) !important;
  border-radius: 8px;
}
.tour-bubble {
  position: fixed;
  z-index: 10000;
  width: min(320px, 88vw);
  background: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,.3);
}
.tour-bubble-step { font-size: 0.74rem; color: #999; }
.tour-bubble-title { margin: 3px 0 6px; font-size: 1rem; }
.tour-bubble-body { margin: 0 0 12px; font-size: 0.9rem; line-height: 1.6; }
.tour-bubble-actions { display: flex; justify-content: space-between; gap: 8px; }
.tour-chooser {
  position: fixed;
  inset: 0;
  z-index: 10010;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
}
.tour-chooser-inner {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  width: min(420px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  text-align: center;
}
.tour-chooser-inner h3 { margin: 0; }
.tour-chooser-group { margin-top: 10px; text-align: left; }
.tour-chooser-group-title {
  margin: 8px 0 4px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
}
.tour-chooser-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0 8px;
}
.tour-chooser-list .btn { width: 100%; }
/* モーダル内のボタンも うっすら明るめの黄色背景に */
.tour-chooser .btn {
  background: #fcf2c4;
  border-color: #e8d68a;
  color: var(--text);
}
.tour-chooser .btn:hover { background: #f7e9a6; }

/* メンバー別カレンダーモーダル (assign_day) */
.dayplan-name-strong.mcal-open {
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}
.mcal-inner { max-width: 460px; }
.mcal-head {
  margin-bottom: 10px;
}
.mcal-name {
  display: block;
  font-size: 1.05rem;
  padding-right: 38px; /* ×ボタンと重ならないように */
}
.mcal-total {
  display: block;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 6px;
}
.mcal-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.mcal-grid {
  display: grid;
  /* 通常: モーダル幅にフィット。 狭くなったら 各セルを最小 36px / 週計 48px で保持し、 親側 overflow-x で横スクロール */
  grid-template-columns: repeat(7, minmax(36px, 1fr)) minmax(48px, 1.2fr);
  gap: 2px;
  width: 100%;
}
.mcal-h {
  text-align: center;
  font-size: 0.72rem;
  color: #888;
  padding: 2px 0;
}
.mcal-h-week { color: #7a5a1a; font-weight: 700; }
.mcal-cell {
  min-height: 54px;
  border-radius: 4px;
  background: #f3f5f7;
  padding: 2px 3px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mcal-other { background: #eef0f2; }
.mcal-other .mcal-date, .mcal-other .mcal-val { color: #b2b2b2; }
.mcal-other-confirmed { background: #e4efe8; }
.mcal-other-confirmed .mcal-val { color: #6f9079; }
.mcal-date { font-size: 0.68rem; color: #666; }
.mcal-val {
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: auto;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.02em;
}
.mcal-confirmed { background: #2e7d32; }
.mcal-confirmed .mcal-date,
.mcal-confirmed .mcal-val { color: #fff; }
.mcal-wish { background: #e2eafc; }
.mcal-wish-off { background: #fde0e0; }
.mcal-none { background: #f3f5f7; }
.mcal-week {
  background: #fff4e0;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #7a5a1a;
}

/* ホーム画面 専用フッター */
.home-footer {
  margin: 36px 0 16px;
  padding: 14px 16px;
  text-align: center;
  color: var(--text-muted, #5b6b7d);
  font-size: 0.82rem;
  line-height: 1.8;
  border-top: 1px solid var(--border, #e1e6ec);
}
.home-footer p { margin: 0; }

/* 基本出勤 (面接・契約更新時の取り決め) — 希望未入力の日にだけ薄く表示する */
.cal-default-shift {
  font-size: 0.62rem;
  color: #9aa0a6;
  line-height: 1.1;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 基本出勤の編集モーダル */
.ds-table { width: 100%; border-collapse: collapse; }
.ds-table .ds-head th {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  text-align: left;
  padding: 0 6px 4px 0;
  border-bottom: 1px solid var(--border);
}
.ds-table .ds-row td { padding: 5px 6px 5px 0; vertical-align: middle; }
.ds-table .ds-cb { width: 2.2em; }
.ds-table .ds-cb input { width: 17px; height: 17px; margin: 0; cursor: pointer; }
.ds-table .ds-day { width: 3.2em; white-space: nowrap; }
.ds-table .ds-day label { cursor: pointer; }
.ds-table .ds-time { white-space: nowrap; }
.ds-table .ds-time select {
  width: auto;
  padding: 4px 6px;
  font-size: 0.92rem;
  margin: 0;
}
.ds-table .ds-sep { color: var(--text-muted); padding: 0 3px; font-size: 0.85rem; }
/* チェックが外れている行は薄くして、 対象外だと分かるようにする */
.ds-table .ds-row:has(input[type="checkbox"]:not(:checked)) .ds-time { opacity: 0.4; }
.ds-table .ds-row-holiday td { border-top: 1px solid var(--border); padding-top: 9px; }
.ds-table .ds-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.5;
  padding: 0 0 2px;
}

/* ナビの件数バッジ (面談の回答待ちなど) */
.nav-badge {
  display: inline-block;
  min-width: 1.35em;
  padding: 0 5px;
  margin-left: 3px;
  background: #fff;
  color: #d81b60;
  border-radius: 9px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.35em;
  text-align: center;
}

/* お知らせの添付 (画像・PDF) */
.news-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.news-attachments .na-img {
  display: block;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  line-height: 0;
  max-width: 220px;
}
.news-attachments .na-img img {
  max-width: 100%;
  height: auto;
  display: block;
}
.news-attachments .na-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  background: #fff;
  font-size: 0.88rem;
}
.news-attachments .na-file:hover { background: #fafafa; }
.news-attachments .na-icon {
  background: #c62828;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 3px;
  letter-spacing: 0.03em;
}
.news-attachments .na-name { word-break: break-all; }
.news-attachments .na-size { color: var(--text-muted); font-size: 0.78rem; white-space: nowrap; }

/* 保存期間を過ぎて実ファイルを消した添付 */
.news-attachments .na-gone {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #fafbfc;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* メニュー最下部の「使い方」 */
.nav-btn.nav-tour {
  background: #fcf2c4;
  border-color: #e8d68a;
  color: var(--text);
}
.nav-btn.nav-tour:hover { background: #f7e9a8; }

/* 店舗名が長くても ヘッダーが横に伸びないよう幅を抑える。
   選択中の文字は切れるが、 開けば全体が読める。 */
.store-switch select { max-width: 11em; }
.store-tag {
  display: inline-block;
  max-width: 12em;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* =========================================================================
   日付を選ぶところ (ブラウザ既定のカレンダーの置き換え)
   js/app.js が <input type="date"> を hidden にして、 この見た目に差し替える
   ========================================================================= */
.dp { display: inline-flex; position: relative; max-width: 100%; }

.dp-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; max-width: 100%;
  border: 1px solid var(--border, #d6dbe1); border-radius: 9px;
  background: #fff; color: var(--text, #23282d);
  font: inherit; font-size: .92rem; line-height: 1.5;
  cursor: pointer; text-align: left;
  transition: border-color .12s, box-shadow .12s;
}
.dp-btn:hover { border-color: #b8c2cc; }
.dp-btn:focus-visible { outline: none; border-color: var(--primary, #2e7dd1);
                        box-shadow: 0 0 0 3px rgba(46,125,209,.18); }
.dp-btn svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--muted, #6b7280); }
.dp-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-btn.is-empty .dp-txt { color: var(--muted, #6b7280); }

/* 開くカレンダー。 body 直下に置いて、 モーダルの中でも切れないようにする */
.dp-pop {
  position: fixed; z-index: 4000;
  width: 268px; padding: 10px;
  background: #fff; border: 1px solid var(--border, #d6dbe1); border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  font-size: .88rem; color: var(--text, #23282d);
}
.dp-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 8px; }
.dp-ym { font-weight: 700; font-size: .95rem; }
.dp-nav {
  width: 30px; height: 30px; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted, #6b7280); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.dp-nav:hover:not([disabled]) { background: #f1f3f5; color: var(--text, #23282d); }
.dp-nav[disabled] { opacity: .3; cursor: default; }
.dp-nav svg { width: 16px; height: 16px; }

.dp-wd, .dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.dp-wd { margin-bottom: 2px; }
.dp-wd span {
  text-align: center; font-size: .72rem; font-weight: 700;
  color: var(--muted, #6b7280); padding: 3px 0;
}
.dp-wd .is-sun, .dp-d.is-sun { color: #d93025; }
.dp-wd .is-sat, .dp-d.is-sat { color: #1a73e8; }

.dp-grid { gap: 1px; }
.dp-d {
  aspect-ratio: 1 / 1; border: 0; border-radius: 50%;
  background: transparent; font: inherit; font-size: .84rem;
  cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.dp-d:hover:not([disabled]):not(.is-sel) { background: #f1f3f5; }
.dp-d.is-off  { opacity: .34; }
.dp-d.is-dis  { opacity: .22; cursor: default; }
.dp-d.is-today:not(.is-sel) { box-shadow: inset 0 0 0 1.5px var(--primary, #2e7dd1); font-weight: 700; }
.dp-d.is-sel {
  background: var(--primary, #2e7dd1); color: #fff !important; font-weight: 700;
}

.dp-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-top: 8px; margin-top: 6px; border-top: 1px solid var(--border, #d6dbe1);
}
.dp-today, .dp-clear {
  border: 1px solid var(--border, #d6dbe1); border-radius: 999px; background: #fff;
  font: inherit; font-size: .78rem; padding: 4px 12px; cursor: pointer;
  color: var(--primary, #2e7dd1);
}
.dp-today:hover:not([disabled]) { background: #eef4fb; }
.dp-today[disabled] { opacity: .35; cursor: default; color: var(--muted, #6b7280); }
.dp-clear { color: var(--muted, #6b7280); margin-left: auto; }
.dp-clear:hover { color: var(--text, #23282d); border-color: #b8c2cc; }

@media (max-width: 420px) {
  .dp-pop { width: min(300px, calc(100vw - 24px)); }
  .dp-d { font-size: .9rem; }
}

/* 年月を選ぶところ (<input type="month">) */
.dp-pop.is-month { width: 240px; }
.dp-mons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.dp-m {
  padding: 9px 0; border: 0; border-radius: 9px;
  background: transparent; font: inherit; font-size: .85rem; cursor: pointer;
  color: var(--text, #23282d);
}
.dp-m:hover:not(.is-sel) { background: #f1f3f5; }
.dp-m.is-today { box-shadow: inset 0 0 0 1.5px var(--primary, #2e7dd1); font-weight: 700; }
.dp-m.is-sel { background: var(--primary, #2e7dd1); color: #fff; font-weight: 700; }

/* 日付＋時刻の 時・分 */
.dp-time {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  padding-top: 9px; margin-top: 7px; border-top: 1px solid var(--border, #d6dbe1);
  font-size: .82rem; color: var(--muted, #6b7280);
}
.dp-time select {
  border: 1px solid var(--border, #d6dbe1); border-radius: 8px;
  padding: 5px 6px; font: inherit; font-size: .85rem; background: #fff;
  color: var(--text, #23282d); cursor: pointer;
}
.dp-time select:focus-visible { outline: none; border-color: var(--primary, #2e7dd1);
                                box-shadow: 0 0 0 3px rgba(46,125,209,.18); }

/* ===== サンプル版の告知 / デモユーザー切替 ===== */
/* バナーはレイアウトの高さを食わないよう画面に浮かせる。
   流れの中に置くと、 チャットのように高さを画面いっぱいに使うページで
   投稿フォームが画面外に押し出されてしまうため。 */
.sample-banner {
  /* ヘッダーのすぐ下に出す。 画面下は投稿フォームや送信ボタンの場所なので避ける
     (ヘッダーは sticky / z-index:50。 それより手前に重ねる) */
  position: fixed;
  top: 68px;
  right: 16px;
  z-index: 900;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 11px 10px 11px 14px;
  border: 1px solid #f0c98a;
  border-left: 4px solid #ed8a2a;
  border-radius: 8px;
  background: #fff8ee;
  color: #7a4a10;
  font-size: .82rem;
  line-height: 1.6;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .16);
  transition: opacity .3s ease, transform .3s ease;
}
.sample-banner.is-hiding { opacity: 0; transform: translateY(-8px); }
.sample-banner-close {
  flex: none;
  padding: 0 4px;
  border: 0;
  background: none;
  color: #b07a35;
  font-size: 1.15rem;
  line-height: 1.2;
  cursor: pointer;
}
.sample-banner-close:hover { color: #7a4a10; }
@media (prefers-reduced-motion: reduce) {
  .sample-banner { transition: none; }
}

/* バナーが消えたあとも「サンプルである」ことが分かるよう、 ヘッダーに常時出す */
.sample-tag {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid #f0c98a;
  border-radius: 4px;
  background: #fff3e0;
  color: #b06a10;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
}

.demo-switch { display: inline-flex; margin: 0; }
.demo-switch select {
  max-width: 200px;
  padding: 6px 10px;
  border: 1px solid #e0d5c4;
  border-radius: 6px;
  background: #fff;
  font-size: .85rem;
  color: #444;
}
