/* =========================================================
   b-screens.css — 勤怠管理・シフト表・スタッフ台帳の専用スタイル
   担当: Agent B（トークンは css/style.css の :root を使用）
   命名: 共通部品=.b-*／勤怠=.att-*／シフト=.sh-*／スタッフ=.st-*
   ========================================================= */

/* ---------------------------------------------------------
   共通部品（この3画面の中だけで使う）
   --------------------------------------------------------- */
.b-screen {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.b-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.b-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 700;
  color: var(--c-text);
}

.b-title svg { width: 22px; height: 22px; flex: 0 0 auto; }

/* 「いつ・何をする画面か」の1行（本体は css/style.css）。
   .b-screen は gap:12 の縦並びなので、こちらでは自前の余白を持たせない */
.b-screen > .c-help { margin: 0; }

.b-monthnav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.b-monthlabel {
  min-width: 15em;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--c-primary-dark);
  font-variant-numeric: tabular-nums;
}

/* 月ラベル兼プルダウン。見た目は .b-monthlabel に揃え、狙った月へ一度で飛べるようにする */
.b-monthsel {
  min-width: 15em;
  max-width: 100%;
  min-height: 40px;
  padding: 0 30px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  background-color: var(--c-surface);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--c-primary-dark) 50%),
    linear-gradient(135deg, var(--c-primary-dark) 50%, transparent 50%);
  background-position: right 15px center, right 10px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  color: var(--c-primary-dark);
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.b-monthsel:hover { background-color: var(--c-primary-pale); border-color: var(--c-primary); }
.b-monthsel:focus { outline: 2px solid var(--c-primary); outline-offset: 1px; }

.b-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.b-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  background: var(--c-surface);
  color: var(--c-text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.b-btn:hover { background: var(--c-primary-pale); border-color: var(--c-primary); }
.b-btn:active { transform: translateY(1px); }
.b-btn:disabled { opacity: .4; cursor: default; }
.b-btn svg { width: 17px; height: 17px; flex: 0 0 auto; }
.b-btn.primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.b-btn.primary:hover { background: var(--c-primary-dark); border-color: var(--c-primary-dark); }
.b-btn.ghost { background: transparent; }
.b-btn.sm { min-height: 32px; padding: 0 10px; font-size: 14px; }
.b-btn.mnav { min-width: 46px; padding: 0; font-size: 15px; }

.b-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--c-line);
  border-radius: 6px;
  background: var(--c-surface);
  color: var(--c-muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}

.b-iconbtn:hover { background: var(--c-primary-pale); color: var(--c-primary-dark); border-color: var(--c-primary); }
.b-iconbtn:disabled { opacity: .3; cursor: default; }
.b-iconbtn svg { width: 15px; height: 15px; }
.b-iconbtn.danger:hover { background: var(--c-red-pale); color: var(--c-red); border-color: var(--c-red); }

.b-seg {
  display: inline-flex;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--c-surface);
}

.b-segbtn {
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-right: 1px solid var(--c-line);
  background: transparent;
  color: var(--c-muted);
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
}

.b-segbtn:last-child { border-right: 0; }
.b-segbtn:hover { background: var(--c-primary-pale); }
.b-segbtn.on { background: var(--c-primary); color: #fff; font-weight: 700; }

.b-empty {
  padding: 40px;
  text-align: center;
  color: var(--c-muted);
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
}

.b-hint {
  margin: 6px 0 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--c-muted);
}

.b-lead { margin: 0 0 12px; font-size: 16px; }

/* 凡例やツールバーの下に置く、控えめな1行の注記（c-screens.css の .c-note 相当） */
.b-noteline {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--c-muted);
}

.b-note { font-size: 13.5px; color: var(--c-muted); white-space: nowrap; }
.b-note.sub { white-space: normal; }

.b-form { font-size: 15px; }

.b-frow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  flex-wrap: wrap;
}

.b-frow > label {
  flex: 0 0 auto;
  width: 11em;
  color: var(--c-muted);
  font-size: 14.5px;
}

.b-frow > label .req {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--c-red-pale);
  color: var(--c-red);
  font-size: 11px;
  font-weight: 700;
}

.b-frow input[type="text"],
.b-frow input[type="time"],
.b-frow input[type="date"],
.b-frow input[type="number"],
.b-frow select {
  flex: 1 1 160px;
  min-width: 120px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  background: var(--c-surface);
  color: var(--c-text);
  font-family: inherit;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.b-frow input:focus,
.b-frow select:focus { outline: 2px solid var(--c-primary); outline-offset: 1px; }
.b-frow input.num { text-align: right; }

.mute { color: var(--c-muted); }

/* ---------------------------------------------------------
   勤怠管理（出勤ノートの再現）
   --------------------------------------------------------- */
.att-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 8px 12px;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  font-size: 13.5px;
  color: var(--c-muted);
}

.att-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.att-legend .lg b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 5px;
  background: var(--c-primary-pale);
  color: var(--c-primary-dark);
  font-size: 13px;
}
.att-legend .lg.tip { margin-left: auto; color: var(--c-primary-dark); }

.att-legend .lg-ot {
  padding: 1px 7px;
  border: 2px solid var(--c-red);
  border-radius: 999px;
  color: var(--c-red);
  font-weight: 700;
  font-size: 12.5px;
}

.att-legend .ovt {
  color: var(--c-red);
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--c-red-pale);
}

.att-legend .lg-sw {
  width: 20px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid var(--c-line);
  display: inline-block;
}

.att-legend .lg-sw.warn { background: var(--c-amber-pale); border-color: var(--c-amber); }
.att-legend .lg-sw.unconf { background: var(--c-amber-pale); }
.att-legend .lg-sw.closed { background: #e9edee; }
.att-legend .lg-sw.miss { background: #fff; border: 2px solid var(--c-red); }
.att-legend .lg-sw.extra { background: #fff; border: 2px solid var(--c-amber); }

/* 表の外枠とスクロール（横スクロールはこの中だけ。親は広げない） */
.att-wrap,
.sh-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
  max-width: 100%;
  max-height: calc(100vh - 268px);
  min-height: 320px;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overscroll-behavior: contain;
}

.att-grid,
.sh-grid {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
}

/* 列幅（正はJS側のインラインstyle。表幅＝列幅合計で固定し、固定列のleftと一致させる） */
.att-grid col.c-date { width: 96px; }
.att-grid col.c-cl { width: 46px; }
.att-grid col.c-zan { width: 54px; }
.att-grid col.c-st { width: 64px; }
.att-grid col.c-part { width: 78px; }
.att-grid col.c-chk { width: 48px; }

.att-grid th,
.att-grid td {
  border-right: 1px solid var(--c-line);
  border-bottom: 1px solid var(--c-line);
  background: var(--c-surface);
  padding: 5px 4px;
  text-align: center;
  vertical-align: middle;
}

.att-grid thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 46px;
  padding: 4px;
  background: var(--c-primary-pale);
  color: var(--c-primary-dark);
  font-size: 14px;
  border-bottom: 2px solid var(--c-primary);
}

.att-grid thead th.stcol { line-height: 1.25; }
.att-grid thead th.stcol .nm { display: block; font-size: 15px; font-weight: 700; }
.att-grid thead th.stcol .rl { display: block; font-size: 11.5px; color: var(--c-muted); }
.att-grid thead th.stcol.t-part { background: var(--c-amber-pale); color: #7a5510; }
.att-grid thead th.stcol.t-part .rl { color: #9b7a3a; }
.att-grid thead th.stcol.t-doctor { background: #eceff0; color: #445055; }

/* 左固定列（leftの値は列幅の累計と一致させること: 96 / 96+46 / 96+46+46） */
.att-grid .l { position: sticky; z-index: 2; }
.att-grid .l0 { left: 0; }
.att-grid .l1 { left: 96px; }
.att-grid .l2 { left: 142px; }
.att-grid .l3 { left: 188px; border-right: 2px solid var(--c-line); }
.att-grid thead .l { z-index: 5; }
.att-grid .r0 { position: sticky; right: 0; z-index: 2; border-left: 2px solid var(--c-line); border-right: 0; }
.att-grid thead .r0 { z-index: 5; }

.att-grid td.dt { text-align: left; padding-left: 8px; line-height: 1.2; }
.att-grid td.dt .d { font-size: 16px; font-weight: 700; }
.att-grid td.dt .w { font-size: 13px; color: var(--c-muted); margin-left: 2px; }
.att-grid td.dt .sub { display: block; font-size: 11.5px; color: var(--c-muted); }

.att-grid td.cl { cursor: pointer; font-size: 14.5px; }
.att-grid td.cl:hover { background: var(--c-primary-pale); box-shadow: inset 0 0 0 2px var(--c-primary); }
.att-grid td.cl.off { color: var(--c-muted); }
.att-grid td.zan { font-size: 14px; }
.att-grid td.zan .minus { color: var(--c-amber); }
.att-grid td.zan .plus { color: var(--c-text); }

/* 行の状態 */
.att-grid tbody tr:hover td,
.att-grid tbody tr:hover th { background: #f2f8f9; }
.att-grid tr.is-sun td.dt .d,
.att-grid tr.is-sun td.dt .w { color: var(--c-red); }
.att-grid tr.is-sat td.dt .d,
.att-grid tr.is-sat td.dt .w { color: #2a6db5; }
.att-grid tr.is-unconf td,
.att-grid tr.is-unconf th { background: var(--c-amber-pale); }
.att-grid tr.is-closed td,
.att-grid tr.is-closed th { background: #e9edee; color: var(--c-muted); }
.att-grid tr.is-half td.dt .sub { color: var(--c-amber); }
.att-grid tr.is-today td,
.att-grid tr.is-today th { box-shadow: inset 0 2px 0 var(--c-primary); }
.att-grid tr.is-today td.dt .d { color: var(--c-primary-dark); }

/* セル */
.att-grid td.att-c { cursor: pointer; padding: 4px 3px; }
.att-grid td.att-c:hover { background: var(--c-primary-pale); box-shadow: inset 0 0 0 2px var(--c-primary); }
.att-grid td.att-c.none { cursor: default; background: repeating-linear-gradient(45deg, #f4f6f7, #f4f6f7 4px, #eceff0 4px, #eceff0 8px); }
.att-grid td.att-c.issue { background: var(--c-amber-pale); box-shadow: inset 0 0 0 2px var(--c-amber); }

.att-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 30px;
  line-height: 1.25;
}

.att-cell .v { font-size: 15px; font-weight: 600; white-space: nowrap; }
.att-cell .v.ot {
  padding: 1px 6px;
  border: 2px solid var(--c-red);
  border-radius: 999px;
  color: var(--c-red);
  font-weight: 700;
}
.att-cell .ovt { font-size: 12px; color: var(--c-red); line-height: 1.2; white-space: nowrap; }
.att-cell .ded { font-size: 11.5px; color: #8a6114; line-height: 1.2; white-space: nowrap; }
.att-cell .seg { font-size: 13px; color: var(--c-muted); white-space: nowrap; }
.att-cell .seg i { font-style: normal; opacity: .5; }
.att-cell .warn { font-size: 12.5px; color: var(--c-amber); font-weight: 700; }
.att-cell .mute { font-size: 14px; }
.att-cell .tr {
  display: inline-block;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--c-primary-pale);
  color: var(--c-primary-dark);
  font-size: 11px;
}

.mk {
  display: inline-block;
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.mk-yu { background: var(--c-green, #1e8e5a); color: #fff; }
.mk-ketsu { background: #9aa7ac; color: #fff; }
.mk-toku { background: var(--c-amber); color: #fff; }

/* 確認チェック */
.att-chkbox { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 4px; }
.att-chkbox input { width: 22px; height: 22px; cursor: pointer; accent-color: var(--c-primary); }

/* 月末集計（下端固定） */
.att-grid tfoot th,
.att-grid tfoot td {
  position: sticky;
  z-index: 3;
  height: 32px;
  padding: 2px 6px;
  background: #f0f5f6;
  border-top: 1px solid var(--c-line);
  font-size: 14.5px;
}

.att-grid tfoot tr:nth-last-child(1) th, .att-grid tfoot tr:nth-last-child(1) td { bottom: 0; }
.att-grid tfoot tr:nth-last-child(2) th, .att-grid tfoot tr:nth-last-child(2) td { bottom: 32px; }
.att-grid tfoot tr:nth-last-child(3) th, .att-grid tfoot tr:nth-last-child(3) td { bottom: 64px; }
.att-grid tfoot tr:nth-last-child(4) th, .att-grid tfoot tr:nth-last-child(4) td { bottom: 96px; }
.att-grid tfoot tr:nth-last-child(5) th, .att-grid tfoot tr:nth-last-child(5) td { bottom: 128px; }
.att-grid tfoot tr.first th,
.att-grid tfoot tr.first td { border-top: 2px solid var(--c-primary); }
.att-grid tfoot .ftlabel { text-align: right; color: var(--c-primary-dark); font-weight: 700; z-index: 4; }
.att-grid tfoot .ftv i { font-style: normal; font-size: 12px; color: var(--c-muted); margin-left: 1px; }
.att-grid tfoot .ot-t { color: var(--c-red); }
.att-grid tfoot .ab-t { color: var(--c-amber); }
.att-grid tfoot .yu-t { color: var(--c-green, #1e8e5a); }

/* ---------- セル編集モーダル ----------
   幅はモーダル側（App.modalのwidth指定）に任せ、中身は流し込むだけにする
   （固定幅を持つとモーダルからはみ出して右端が切れる） */
.att-edit {
  width: 100%;
  font-size: 15px;
}

.att-edit-head {
  padding: 0 0 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--c-line);
}

.att-edit-head .ttl { display: flex; align-items: center; gap: 8px; font-size: 19px; }
.att-edit-head .sum { font-size: 14.5px; color: var(--c-muted); margin-top: 3px; }
.att-edit-head .sum b { color: var(--c-text); font-variant-numeric: tabular-nums; }
.att-edit-head .sum .ot-t { color: var(--c-red); }
.att-edit-head .sum .ded-t { color: var(--c-amber); }
.att-edit-head .cl { color: var(--c-amber); }
.att-edit-head .bd {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12.5px;
  background: var(--c-primary-pale);
  color: var(--c-primary-dark);
}
.att-edit-head .bd.t-part { background: var(--c-amber-pale); color: #7a5510; }
.att-edit-head .bd.t-doctor { background: #eceff0; color: #445055; }

.att-sec { margin: 0 0 16px; }
.att-sec h4 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--c-primary-dark);
}
.att-sec h4 svg { width: 17px; height: 17px; }

.att-plist { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }

.att-prow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  background: var(--c-bg);
}

.att-prow select,
.att-prow input[type="time"] {
  min-height: 38px;
  padding: 0 8px;
  border: 1px solid var(--c-line);
  border-radius: 6px;
  background: var(--c-surface);
  font-family: inherit;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.att-prow select { width: 86px; }
.att-prow input[type="time"] { width: 130px; }
.att-src { font-size: 12.5px; color: var(--c-muted); margin-left: auto; }
.att-pnone { padding: 10px; color: var(--c-muted); font-size: 14px; background: var(--c-bg); border-radius: 8px; }

.att-marks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }

.att-mark {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--c-line);
  border-radius: 999px;
  background: var(--c-surface);
  cursor: pointer;
  font-size: 15px;
}

.att-mark:hover { background: var(--c-primary-pale); }
.att-mark input { width: 18px; height: 18px; accent-color: var(--c-primary); }
.att-mark.on { background: var(--c-primary); border-color: var(--c-primary); color: #fff; font-weight: 700; }

.att-deduction {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  background: var(--c-bg);
}

.att-deduction > label {
  display: block;
  margin-bottom: 7px;
  font-weight: 700;
  color: var(--c-text);
}

.att-deduction-inputs {
  display: flex;
  align-items: center;
  gap: 7px;
}

.att-deduction-inputs input {
  width: 84px;
  min-height: 40px;
  padding: 0 8px;
  border: 1px solid var(--c-line);
  border-radius: 6px;
  background: var(--c-surface);
  font: inherit;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.att-deduction-inputs span { color: var(--c-muted); }
.att-deduction-inputs b { color: var(--c-muted); font-size: 18px; }
.att-deduction .b-hint { margin-bottom: 0; }

.att-radio { display: inline-flex; align-items: center; gap: 5px; font-size: 15px; cursor: pointer; }
.att-radio input { width: 18px; height: 18px; accent-color: var(--c-primary); }

.att-trlist { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }

.att-trrow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  background: var(--c-bg);
  font-size: 14.5px;
}

.att-trrow .tag { padding: 1px 8px; border-radius: 999px; font-size: 12.5px; color: #fff; }
.att-trrow .tag.out { background: var(--c-primary); }
.att-trrow .tag.in { background: #9aa7ac; }
.att-trrow .nt { color: var(--c-muted); flex: 1; }
.att-trrow button { margin-left: auto; }

.att-tradd { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.att-tradd input[type="number"] { width: 88px; }
.att-tradd input[type="text"] { flex: 1 1 180px; }
.att-tradd input {
  min-height: 38px;
  padding: 0 8px;
  border: 1px solid var(--c-line);
  border-radius: 6px;
  font-family: inherit;
  font-size: 15px;
}
.att-tradd .u { font-size: 14px; color: var(--c-muted); margin-left: -4px; }

.att-clinicform { width: min(460px, 84vw); }

/* ---------------------------------------------------------
   シフト表
   --------------------------------------------------------- */
.sh-grid col.c-date { width: 84px; }
.sh-grid col.c-part { width: 96px; }
.sh-grid col.c-full { width: 62px; }
.sh-grid col.c-cnt { width: 54px; }
.sh-grid col.c-rem { width: 150px; }

.sh-grid th,
.sh-grid td {
  border-right: 1px solid var(--c-line);
  border-bottom: 1px solid var(--c-line);
  background: var(--c-surface);
  padding: 3px;
  text-align: center;
  vertical-align: middle;
}

.sh-grid thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 58px;
  background: var(--c-primary-pale);
  color: var(--c-primary-dark);
  font-size: 14px;
  border-bottom: 2px solid var(--c-primary);
}

.sh-grid thead th.sh-st { padding: 3px 2px; line-height: 1.2; }
.sh-grid thead th.sh-st .nm { display: block; font-size: 12px; color: var(--c-muted); }
.sh-grid thead th.sh-st .kn { display: block; font-size: 15px; font-weight: 700; }
.sh-grid thead th.sh-st.t-part { background: var(--c-amber-pale); color: #7a5510; }
.sh-grid thead th.sh-st.t-doctor { background: #eceff0; color: #445055; }
.sh-grid thead th.sh-st .abc { display: flex; justify-content: center; gap: 2px; margin-top: 2px; }
.sh-grid thead th.sh-st .abc i {
  flex: 1 1 0;
  font-style: normal;
  font-size: 11px;
  background: rgba(255, 255, 255, .7);
  border-radius: 3px;
}

.sh-grid .l0 { position: sticky; left: 0; z-index: 2; border-right: 2px solid var(--c-line); }
.sh-grid thead .l0 { z-index: 5; }
.sh-grid td.dt { text-align: left; padding-left: 8px; }
.sh-grid td.dt .d { font-size: 16px; font-weight: 700; }
.sh-grid td.dt .w { font-size: 13px; color: var(--c-muted); margin-left: 2px; }

.sh-grid tr.is-sun td.dt .d, .sh-grid tr.is-sun td.dt .w { color: var(--c-red); }
.sh-grid tr.is-sat td.dt .d, .sh-grid tr.is-sat td.dt .w { color: #2a6db5; }
.sh-grid tr.is-closed td, .sh-grid tr.is-closed th { background: #e9edee; }
.sh-grid tr.is-today td { box-shadow: inset 0 2px 0 var(--c-primary); }
.sh-grid tbody tr:hover td { background: #f2f8f9; }

.sh-grid td.sh-grp { padding: 2px; }
.sh-grid td.sh-grp.df-miss { box-shadow: inset 0 0 0 2px var(--c-red); }
.sh-grid td.sh-grp.df-extra { box-shadow: inset 0 0 0 2px var(--c-amber); }

.sh-grp { display: table-cell; }
.sh-grp .sc,
.st-shrow .sc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 30px;
  margin: 0 1px;
  padding: 0;
  border: 1px solid var(--c-line);
  border-radius: 6px;
  background: var(--c-surface);
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
}

.sh-grp .sc.wide, .st-shrow .sc.wide { width: 54px; }
.st-shrow .sc.wide { width: 74px; font-size: 14px; }
.sh-grp .sc:hover, .st-shrow .sc:hover { background: var(--c-primary-pale); border-color: var(--c-primary); }
.sh-grp .sc.on, .st-shrow .sc.on { background: var(--c-primary); border-color: var(--c-primary); color: #fff; font-weight: 700; }
.sh-grp .sc.dis { opacity: .35; }
.sh-grp .sc .gh, .st-shrow .sc .gh { color: var(--c-muted); font-size: 13px; }
.sh-grp .sc.on .gh, .st-shrow .sc.on .gh { color: #fff; }
.sh-grp .sc .ma, .st-shrow .sc .ma { font-size: 16px; line-height: 1; }

.sh-grid td.sh-cnt { font-size: 15px; font-weight: 600; background: #f7fafa; }
.sh-grid td.sh-rem { text-align: left; padding-left: 8px; font-size: 13px; color: var(--c-amber); }

.sh-grid tfoot th,
.sh-grid tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 3;
  height: 32px;
  background: #f0f5f6;
  border-top: 2px solid var(--c-primary);
  font-size: 14.5px;
  font-weight: 700;
}

.sh-grid tfoot .ftlabel { text-align: right; padding-right: 8px; color: var(--c-primary-dark); z-index: 4; }
.sh-grid tfoot .ftv i { font-style: normal; font-size: 12px; color: var(--c-muted); }

/* ---------------------------------------------------------
   スタッフ台帳
   --------------------------------------------------------- */
.st-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
  max-width: 100%;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.st-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.st-table th,
.st-table td {
  border-bottom: 1px solid var(--c-line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
}

.st-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--c-primary-pale);
  color: var(--c-primary-dark);
  font-size: 14px;
  border-bottom: 2px solid var(--c-primary);
  white-space: nowrap;
}

.st-table tbody tr:hover td { background: #f2f8f9; }
.st-table tr.retired td { opacity: .55; }

.st-table .c-ord { width: 78px; white-space: nowrap; }
.st-table .c-nm { min-width: 170px; }
.st-table .c-tp { width: 86px; }
.st-table .c-rl { width: 70px; }
.st-table .c-wg { min-width: 210px; }
.st-table .c-fy { width: 230px; }
.st-table .c-cd { width: 84px; }
.st-table .c-op { width: 150px; white-space: nowrap; }
.st-table .c-n { width: 74px; text-align: center; }
.st-table .c-bar { width: 130px; }
.st-table .c-gd { width: 110px; }
.st-table .c-5 { width: 96px; }

.st-table .c-nm b { font-size: 16px; }
.st-table .kn { display: block; font-size: 12.5px; color: var(--c-muted); }
.st-table .sub { display: block; font-size: 12.5px; color: var(--c-muted); }
.st-table .c-n i { font-style: normal; font-size: 12px; color: var(--c-muted); margin-left: 1px; }
.st-table .c-n .ng { color: var(--c-red); }
.st-table .c-cd code {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--c-bg);
  border: 1px solid var(--c-line);
  font-size: 13.5px;
}
.st-table .c-op .b-btn { margin-right: 4px; }
.st-table .c-op .b-btn svg { width: 15px; height: 15px; }

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

.st-badge.t-seishain { background: var(--c-primary-pale); color: var(--c-primary-dark); }
.st-badge.t-part { background: var(--c-amber-pale); color: #7a5510; }
.st-badge.t-doctor { background: #eceff0; color: #445055; }
.st-badge.off { background: #eceff0; color: var(--c-muted); margin-left: 6px; }
.st-badge.ok { background: var(--c-green, #1e8e5a); color: #fff; }
.st-badge.warn { background: var(--c-amber-pale); color: #7a5510; }

.st-bar { display: flex; flex-direction: column; gap: 3px; }
.st-bar .tr { height: 9px; border-radius: 999px; background: #e6ebec; overflow: hidden; }
.st-bar .tr i { display: block; height: 100%; border-radius: 999px; background: var(--c-primary); }
.st-bar .tr i.mid { background: var(--c-amber); }
.st-bar .tr i.hi { background: var(--c-red); }
.st-bar .tx { font-size: 12.5px; color: var(--c-muted); }
.st-bar .tx b { margin-left: 6px; color: var(--c-primary-dark); }
.st-bar .tx b.mid { color: var(--c-amber); }
.st-bar .tx b.hi { color: var(--c-red); }

.st-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--c-muted); cursor: pointer; }
.st-toggle input { width: 18px; height: 18px; accent-color: var(--c-primary); }

/* 編集フォーム（スタッフ編集モーダル内のみ。設定画面の .st-form と衝突させないため .modal でスコープ。
   幅はモーダル側のwidth指定に任せる — 固定幅だとモーダルからはみ出す） */
.modal .st-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 4px 24px;
  align-items: start;
  width: 100%;
}

.modal .st-form .att-sec { margin-bottom: 12px; }
.modal .st-form .b-frow > label { width: 9.5em; }
/* チェックボックスの行（雇用保険・打刻しない・残業代）は、項目名の幅（9.5em）を当てない。
   当てると「打刻しない（給与だけ）」が2〜3行に折れて読みにくい（v1.8.0） */
.modal .st-form .b-frow > label.st-toggle { width: auto; flex: 1 1 auto; }
.st-presets { display: flex; flex-wrap: wrap; gap: 6px; }

.st-shifts { display: flex; flex-direction: column; gap: 4px; }
.st-shrow { display: flex; align-items: center; gap: 4px; }
.st-shrow .wk {
  width: 2em;
  font-size: 15px;
  font-weight: 700;
  color: var(--c-muted);
}

/* QRカード選択 */
.st-qrtools { display: flex; gap: 8px; margin-bottom: 10px; }
.st-qrlist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 6px;
  width: 100%;
  max-height: 46vh;
  overflow: auto;
}

.st-qritem {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  background: var(--c-bg);
  cursor: pointer;
  font-size: 15px;
}

.st-qritem:hover { background: var(--c-primary-pale); }
.st-qritem input { width: 20px; height: 20px; accent-color: var(--c-primary); }
.st-qritem .nm { flex: 1; }
.st-qritem .cd { font-size: 12.5px; color: var(--c-muted); }

/* ---------------------------------------------------------
   スマートフォン（幅640px以下）
   ページ全体は絶対に横へ揺らさない。横スクロールは表の外枠
   （.att-wrap／.sh-wrap／.st-wrap）の中だけに閉じ込め、
   表以外（ツールバー・凡例・注記・フォーム）は折り返して収める。
   --------------------------------------------------------- */
@media (max-width: 640px) {
  .b-screen { max-width: 100%; gap: 10px; }

  /* ツールバー: 月プルダウンを1段目、‹ › 今月 を2段目に折り返す */
  .b-head { align-items: stretch; gap: 8px 10px; max-width: 100%; min-width: 0; }
  .b-title { font-size: 18px; }
  .b-monthnav { flex: 1 1 100%; flex-wrap: wrap; min-width: 0; gap: 6px; }
  .b-monthsel { flex: 1 1 100%; order: -1; width: 100%; min-width: 0; padding: 0 26px; font-size: 16px; }
  .b-monthnav .b-btn { flex: 1 1 0; min-width: 0; min-height: 44px; font-size: 15px; }
  .b-actions { width: 100%; margin-left: 0; }
  .b-actions .b-btn { flex: 1 1 auto; min-width: 0; }
  .b-seg { width: 100%; }
  .b-segbtn { flex: 1 1 0; min-width: 0; padding: 0 6px; }
  .st-toggle { width: 100%; }

  /* 凡例: 折り返して字は潰さない */
  .att-legend { gap: 8px 14px; padding: 8px 10px; }
  .att-legend .lg { min-width: 0; }
  .att-legend .lg.tip { flex: 1 1 100%; margin-left: 0; }
  .b-noteline { font-size: 14px; }

  /* 横スクロールはここだけ */
  .att-wrap,
  .sh-wrap,
  .st-wrap {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .att-wrap,
  .sh-wrap { max-height: 62vh; min-height: 240px; }
  .st-wrap { max-height: 68vh; }

  /* モーダルのフォームは縦1カラム・ラベルは上・入力欄ははみ出さない */
  .modal .st-form { grid-template-columns: 1fr; gap: 0; }
  .modal .st-form .b-frow > label,
  .b-frow > label { width: 100%; }
  .b-frow { gap: 6px 10px; }
  .b-frow input[type="text"],
  .b-frow input[type="time"],
  .b-frow input[type="date"],
  .b-frow input[type="number"],
  .b-frow select { flex: 1 1 120px; min-width: 0; }
  .b-note.sub { flex: 1 1 100%; }

  .att-clinicform { width: 100%; }
  .att-prow { flex-wrap: wrap; }
  .att-prow select { width: 104px; }
  .att-prow input[type="time"] { flex: 1 1 120px; width: auto; min-width: 0; }
  .att-src { margin-left: 4px; }
  .att-tradd input[type="number"] { width: 76px; }
  .att-tradd input[type="text"] { flex: 1 1 100%; min-width: 0; }
  .st-qrlist { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------
   画面をそのまま印刷した場合の保険（帳票は App.print 経由）
   --------------------------------------------------------- */
@media print {
  .att-wrap, .sh-wrap, .st-wrap { max-height: none; overflow: visible; box-shadow: none; }
  .att-grid thead th, .sh-grid thead th, .st-table thead th { position: static; }
  .att-grid .l, .att-grid .r0, .sh-grid .l0 { position: static; }
  .att-grid tfoot th, .att-grid tfoot td, .sh-grid tfoot th, .sh-grid tfoot td { position: static; }
  .b-actions, .b-seg, .b-monthnav .b-btn { display: none; }
  /* 月プルダウンは印刷では月ラベルとして出す */
  .b-monthsel {
    border: 0; padding: 0; background: none; text-align: left;
    -webkit-appearance: none; appearance: none;
  }
}

/* ===== v1.4 勤怠: 問題のみ表示・ジャンプ =====
   密な表（31日×15名）から、直すところだけを拾えるようにする道具立て。
   見た目は既存の .b-seg / .b-segbtn / .c-chip をそのまま流用する。 */

/* 表示モードの切替は「全員／正社員／パート」の右側に置く */
.b-seg.att-viewseg { margin-left: auto; }

/* 件数チップと「次の問題へ」の行（凡例のすぐ下） */
.att-flags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  min-width: 0;
}

/* チップはボタン。見た目は .c-chip のまま、押せることだけ足す */
.att-chip {
  font-family: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.att-chip:hover { border-color: var(--c-amber); background: #fbeecd; }
.att-chip:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 1px; }
.att-flagok { cursor: default; }

.att-jump {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  min-width: 0;
}
.att-jump .att-jumpn {
  margin-left: 2px;
  font-size: 13px;
  color: var(--c-muted);
  font-variant-numeric: tabular-nums;
}
.att-jump .b-btn:hover .att-jumpn { color: var(--c-primary-dark); }

/* 給与が確定済みの月であることを月見出しの横に出す */
.att-lockchip { white-space: nowrap; }

/* 「次の問題へ」で飛んだ先のマス（2秒だけ強調する） */
.att-grid td.att-c.is-focus {
  box-shadow: inset 0 0 0 3px var(--c-primary), 0 0 0 1px var(--c-primary);
  background: var(--c-primary-pale);
}
.att-grid td.att-c.issue.is-focus {
  box-shadow: inset 0 0 0 3px var(--c-primary);
  background: var(--c-amber-pale);
}

/* スマートフォン: ツールバーを縦に積み、横へはみ出させない */
@media (max-width: 640px) {
  .b-seg.att-viewseg { margin-left: 0; width: 100%; }
  .att-flags { width: 100%; gap: 8px; }
  .att-chip { flex: 1 1 auto; justify-content: center; min-width: 0; }
  .att-flagok { flex: 1 1 100%; justify-content: center; }
  .att-jump { width: 100%; margin-left: 0; }
  .att-jump .b-btn { flex: 1 1 0; min-width: 0; min-height: 40px; }
  .att-lockchip { margin-left: 0; }
}

/* 印刷では画面操作の部品を出さない */
@media print {
  .att-flags { display: none; }
}
