/* シフト表の自動作成の体験版。色は common/base.css のトークンだけを使う */
.sh { max-width: 1280px; margin: 0 auto; padding: 20px var(--gutter) 56px; }

/* 作業の流れ（1→2→3） */
.sh-steps { display: flex; align-items: center; gap: 10px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; width: fit-content; max-width: 100%; margin: 0 auto 22px; box-shadow: var(--shadow-s); }
.sh-steps button { display: flex; align-items: center; gap: 8px; padding: 7px 16px 7px 8px; border-radius: 999px; font-size: 14px; font-weight: 700; color: var(--ink-3); white-space: nowrap; }
.sh-steps button:disabled { cursor: default; opacity: .55; }
.sh-steps button:not(:disabled):hover { background: var(--sunken); color: var(--ink); }
.sh-steps .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--sunken); font-size: 13px; }
.sh-steps button[aria-current="step"] { background: var(--brand); color: #fff; }
.sh-steps button[aria-current="step"] .n { background: var(--accent); color: #fff; }
.sh-steps button.done .n { background: var(--ok-soft); color: var(--ok); }
.sh-steps-line { width: 22px; height: 2px; background: var(--line-2); flex: none; }

.scr-head { max-width: 780px; margin-bottom: 18px; }
.scr-head h2 { font-size: 24px; font-weight: 800; line-height: 1.4; }
.scr-lead { margin-top: 6px; color: var(--ink-2); line-height: 1.85; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px 18px; box-shadow: var(--shadow-s); min-width: 0; margin-bottom: 16px; }
.card h3 { font-size: 16.5px; font-weight: 800; line-height: 1.5; }
.card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.card-head h3 { margin-right: auto; }
.head-actions { display: inline-flex; gap: 8px; }
.card-note { margin-top: 8px; font-size: 12.5px; color: var(--ink-3); line-height: 1.75; white-space: pre-line; }
.two { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; align-items: start; }
.two .card { margin-bottom: 16px; }

.tbl-scroll { margin-top: 10px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); scrollbar-width: thin; }
.tbl-scroll[data-scroll-x] { }

/* 希望休カレンダー・シフト表 */
.grid { border-collapse: separate; border-spacing: 0; font-size: 13px; width: max-content; min-width: 100%; }
.grid th, .grid td { padding: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; }
.grid thead th { position: sticky; top: 0; background: var(--brand); color: var(--on-brand); font-weight: 700; height: 24px; z-index: 1; }
.grid thead th.dh { width: 32px; min-width: 32px; font-size: 12.5px; }
.grid thead th.dw { font-size: 11.5px; font-weight: 600; }
.grid thead th.sun { background: var(--bad); color: #fff; }
.grid thead th.sat { background: var(--brand-2); color: #fff; }
.grid th.nm { position: sticky; left: 0; z-index: 2; background: var(--surface); color: var(--ink); text-align: left; padding: 0 8px 0 10px; min-width: 112px; width: 112px; font-weight: 700; white-space: nowrap; box-shadow: 1px 0 0 var(--line-2); }
.grid thead th.nm { background: var(--brand); color: #fff; z-index: 3; vertical-align: middle; }
.grid th.nm .nm-t { font-size: 13px; }
.role { display: inline-grid; place-items: center; width: 17px; height: 17px; margin-left: 5px; border-radius: 4px; font-size: 10.5px; font-weight: 700; vertical-align: 1px; }
.role.lead { background: var(--accent-soft); color: var(--accent-deep); }
.role.new { background: var(--sunken); color: var(--ink-2); }
.grid td.c { width: 32px; min-width: 32px; height: 32px; background: var(--surface); }
.grid td.c.we { background: var(--paper); }
.grid td.c .cell { display: block; width: 100%; height: 100%; min-height: 32px; font-size: 13px; font-weight: 700; color: inherit; background: transparent; line-height: 1; padding: 0; }
.grid tbody td.c { color: var(--ink-2); }
.grid td.c .cell:hover { background: rgba(23, 57, 74, .09); }
.grid td.c .cell:focus-visible { outline-offset: -2px; }
.grid td.c.k-早 { background: var(--warn-soft); color: var(--warn); }
.grid td.c.k-遅 { background: var(--brand-soft); color: var(--brand-2); }
.grid td.c.k-通 { background: var(--ok-soft); color: var(--ok); }
.grid td.c.k-欠 { background: var(--bad-soft); color: var(--bad); }
.grid td.c.off { background: var(--sunken); color: var(--ink-3); }
.grid td.c.bad { background: var(--bad); color: #fff; }
#calTable td.c.off { background: var(--accent-soft); color: var(--accent-deep); }
.grid tr.foot th.nm { font-weight: 600; background: var(--surface); }
.grid tr.foot th.nm .nm-t { font-size: 12px; color: var(--ink-2); }
.grid tr.foot:first-of-type th.nm, .grid tr.foot:first-of-type td { border-top: 2px solid var(--line-2); }
.grid td.f { height: 26px; font-size: 11.5px; font-weight: 700; background: var(--surface); }
.grid td.f.ok { background: var(--ok-soft); color: var(--ok); }
.grid td.f.short { background: var(--bad-soft); color: var(--bad); }
.grid td.f.more { background: var(--warn-soft); color: var(--warn); }
#exGrid td.c { height: 28px; font-size: 13px; font-weight: 700; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12px; color: var(--ink-2); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg-note { color: var(--ink-3); }
.sw { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--line-2); background: var(--surface); }
.sw.k-早 { background: var(--warn-soft); } .sw.k-遅 { background: var(--brand-soft); } .sw.k-通 { background: var(--ok-soft); }
.sw.k-欠 { background: var(--bad-soft); } .sw.off { background: var(--sunken); } .sw.bad { background: var(--bad); border-color: var(--bad); }

/* 必要人数・決まりごと・スタッフ */
.mini-table { border-collapse: collapse; width: 100%; font-size: 13.5px; margin-top: 10px; }
.mini-table th { text-align: left; font-size: 12px; color: var(--ink-3); font-weight: 700; padding: 6px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.mini-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.mini-table tr:last-child td { border-bottom: 0; }
.mini-table .nm-c { font-weight: 700; }
.mini-table td.kinds { white-space: normal; }
.mini-table .bad-t { color: var(--bad); font-weight: 700; }
#needTable td:first-child { font-weight: 700; }
.rule-h { font-size: 13px; font-weight: 800; color: var(--accent-deep); margin: 12px 0 4px; }
.rule-h:first-of-type { margin-top: 8px; }
.rule-list { list-style: none; display: grid; gap: 4px; font-size: 14px; line-height: 1.65; }
.rule-list li { position: relative; padding-left: 18px; }
.rule-list li::before { content: ''; position: absolute; left: 3px; top: .72em; width: 7px; height: 7px; border-radius: 50%; background: var(--brand-2); }

/* 下に固定の操作バー（高さは 96px 以下） */
.pick-foot {
  position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 16px; margin: 20px calc(var(--gutter) * -1) 0; padding: 14px var(--gutter) calc(14px + env(safe-area-inset-bottom));
  background: rgba(246, 244, 238, .94); backdrop-filter: blur(6px); border-top: 1px solid var(--line);
}
.pick-note { font-size: 12.5px; color: var(--ink-3); line-height: 1.6; flex: 1; }
.btn-big { min-height: 50px; padding: 0 26px; font-size: 16px; border-radius: 12px; }

/* 結果のまとめ */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; transition: opacity .3s; }
.tiles.pending { opacity: 0; }
.tile { padding: 12px 14px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-s); }
.tile b { display: block; font-size: 28px; line-height: 1.2; font-weight: 800; }
.tile b small { font-size: 15px; font-weight: 700; margin-left: 2px; }
.tile span { display: block; font-size: 13px; color: var(--ink); font-weight: 700; line-height: 1.45; margin-top: 2px; }
.tile em { display: block; font-style: normal; font-size: 11.5px; color: var(--ink-3); line-height: 1.5; margin-top: 2px; }
.tile.ok b { color: var(--ok); } .tile.warn b { color: var(--warn); } .tile.bad b { color: var(--bad); } .tile.none b { color: var(--ink-3); }

.issue { border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--r-m); padding: 10px 14px 12px; margin-top: 10px; background: var(--surface); }
.issue.hard { border-left-color: var(--bad); background: var(--bad-soft); border-color: var(--bad-line); border-left-color: var(--bad); }
.issue.warn { border-left-color: var(--warn-line); background: var(--warn-soft); border-color: var(--warn-line); }
.i-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.i-top b { font-size: 14.5px; }
.i-who { font-size: 13px; color: var(--ink-2); }
.i-detail { margin-top: 4px; font-weight: 700; font-size: 14px; line-height: 1.65; }
.i-reason { margin-top: 4px; font-size: 13.5px; line-height: 1.75; color: var(--ink-2); }
.i-reason b { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 1px; }
.issue-none { padding: 10px 12px; border-radius: var(--r-s); background: var(--ok-soft); color: var(--ok); font-weight: 600; margin-top: 10px; }
.notes-h { margin-top: 16px; font-size: 13px; color: var(--warn); }
.person-table td, .person-table th { padding: 6px 12px; }

.foot-btns { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 4px; }

/* マスの操作 */
.cp { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 16px; }
.cp-back { position: absolute; inset: 0; background: rgba(22, 36, 44, .45); }
.cp-card { position: relative; width: min(480px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-l); padding: 16px 20px 18px; }
.cp-top { display: flex; align-items: flex-start; gap: 8px; }
.cp-top h3 { flex: 1; font-size: 17px; font-weight: 800; line-height: 1.5; }
.cp-x { width: 34px; height: 34px; margin: -4px -8px 0 0; border-radius: 8px; display: grid; place-items: center; color: var(--ink-3); flex: none; }
.cp-x:hover { background: var(--sunken); color: var(--ink); }
.cp-x svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
.cp-now { margin-top: 4px; font-size: 14px; color: var(--ink-2); }
.cp-now b { color: var(--ink); }
.cp-h { margin-top: 16px; font-size: 14.5px; font-weight: 800; }
.cp-note { margin-top: 4px; font-size: 13px; color: var(--ink-2); line-height: 1.75; }
.seg4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.seg4 .btn { padding: 0 4px; }
.seg4 .btn.on { background: var(--brand); border-color: var(--brand); color: #fff; }
#cpCands { margin-top: 10px; width: 100%; }
.cand-list { display: grid; gap: 8px; margin-top: 10px; }
.cand { position: relative; border: 1.5px solid var(--line); border-radius: var(--r-m); padding: 10px 12px; padding-right: 128px; background: var(--surface); }
.cand-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.cand-top b { font-size: 15px; }
.rank { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; }
.cand-sub { margin-top: 4px; font-size: 12.5px; color: var(--ink-3); line-height: 1.6; }
.cand .pick { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.excl { margin-top: 12px; font-size: 13px; }
.excl summary { cursor: pointer; font-weight: 700; color: var(--ink-2); padding: 4px 0; }
.excl ul { list-style: none; margin-top: 6px; display: grid; gap: 4px; line-height: 1.6; color: var(--ink-2); }
.cp-foot { margin-top: 12px; }

/* 3. Excelにまとめる */
.ex-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 20px; box-shadow: var(--shadow-s); margin-bottom: 16px; }
.ex-box .tiles { margin-bottom: 0; }
.ex-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

@media (max-width: 900px) {
  .two { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .sh { padding-top: 14px; }
  .sh-steps { gap: 4px; width: 100%; justify-content: space-between; padding: 4px; }
  .sh-steps button { padding: 6px 8px 6px 6px; font-size: 12.5px; gap: 6px; }
  .sh-steps .n { width: 22px; height: 22px; font-size: 12px; }
  .sh-steps-line { width: 8px; flex: 1; }
  .sh-steps button:not([aria-current="step"]) .t { display: none; }
  .sh-steps button:not([aria-current="step"]) { padding: 6px; }
  .scr-head h2 { font-size: 20px; }
  .card { padding: 14px; }
  .grid th.nm { min-width: 92px; width: 92px; padding: 0 4px 0 7px; }
  .grid th.nm .nm-t { font-size: 12px; }
  .grid tr.foot th.nm .nm-t { font-size: 10.5px; white-space: normal; line-height: 1.3; display: inline-block; }
  .grid thead th.dh, .grid td.c { width: 30px; min-width: 30px; }
  .grid td.c .cell { min-height: 34px; }
  .pick-foot { gap: 10px; }
  .pick-note { display: none; }
  .pick-foot .btn { width: 100%; }
  .tile b { font-size: 24px; }
  .foot-btns .btn { flex: 1; min-width: 0; padding: 0 10px; }
  .cp { align-items: end; padding: 0; }
  .cp-card { width: 100%; border-radius: var(--r-l) var(--r-l) 0 0; max-height: 80dvh; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .cand { padding-right: 12px; padding-bottom: 54px; }
  .cand .pick { top: auto; bottom: 10px; right: 10px; transform: none; }
  .mini-table td, .mini-table th { padding: 6px 8px; }
}

/* 手で変えた直後の印 */
.change-note { margin: 4px 0 10px; padding: 8px 12px; border-radius: var(--r-s); background: var(--brand-soft); border-left: 4px solid var(--brand-2); font-size: 13.5px; font-weight: 600; line-height: 1.6; }
.change-note[hidden] { display: none; }
.grid td.c.chg .cell { box-shadow: inset 0 0 0 3px var(--brand-2); }
.grid td.c.newbad .cell { outline: 3px dashed var(--bad); outline-offset: -3px; }
.grid td.f.newf { outline: 3px dashed var(--bad); outline-offset: -3px; }
.sw.chg { background: var(--surface); box-shadow: inset 0 0 0 3px var(--brand-2); }
.sw.newbad { background: var(--surface); border: 2px dashed var(--bad); }
.issue.is-new { box-shadow: 0 0 0 2px var(--accent); }
.i-jump { margin-top: 6px; }
.flash { animation: flashring 2.4s ease; position: relative; z-index: 1; }
@keyframes flashring { 0%, 70% { box-shadow: 0 0 0 4px var(--accent), 0 0 0 8px rgba(194, 106, 23, .25); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .flash { animation: none; box-shadow: 0 0 0 4px var(--accent); } }
