:root {
  --bg: #f4f6f9; --card: #fff; --ink: #1f2937; --sub: #6b7280; --line: #e5e7eb; --brand: #1f4e8c;
  --ok: #15803d; --ok-bg: #dcfce7; --brk: #a16207; --brk-bg: #fef3c7; --done: #475569; --done-bg: #e2e8f0;
  --ng: #b91c1c; --ng-bg: #fee2e2; --abs: #7c2d12; --abs-bg: #ffedd5; --lv: #4338ca; --lv-bg: #e0e7ff;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Yu Gothic UI", "Meiryo UI", "Hiragino Sans", system-ui, sans-serif; font-size: 14px; }
header { background: var(--brand); color: #fff; padding: 10px 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
header h1 { font-size: 17px; margin: 0; letter-spacing: .02em; }
header .meta { margin-left: auto; font-size: 12px; opacity: .95; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
header a, header button.link { color: #fff; background: none; border: 0; font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }
.live { display: inline-flex; align-items: center; gap: 6px; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; display: inline-block; }
.live.stale i { background: #f59e0b; }
nav { background: #fff; border-bottom: 1px solid var(--line); padding: 0 16px; display: flex; gap: 4px; overflow-x: auto; }
nav button { background: none; border: 0; padding: 12px 14px; font: inherit; font-size: 14px; color: var(--sub); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
nav button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); font-weight: 700; }
nav .badge { background: var(--ng); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; margin-left: 4px; }
nav .badge.zero { background: #9ca3af; }
main { padding: 16px 20px 40px; max-width: 1280px; margin: 0 auto; }
.panel { display: none; } .panel.on { display: block; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.tile b { display: block; font-size: 24px; line-height: 1.2; }
.tile span { font-size: 12px; color: var(--sub); }
.tile.sel { outline: 2px solid var(--brand); }
.tile.k-ok b { color: var(--ok); } .tile.k-brk b { color: var(--brk); } .tile.k-ng b { color: var(--ng); } .tile.k-abs b { color: var(--abs); }
.bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.bar select, .bar input[type=search], .bar input[type=text] { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; color: var(--ink); }
.bar input[type=search] { min-width: 200px; }
.bar input.full { min-width: 0; width: 100%; }
.bar label { color: var(--sub); font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: auto; }
.card.pad { padding: 12px 16px; margin-bottom: 12px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #f8fafc; font-size: 12px; color: var(--sub); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.code { color: var(--sub); font-size: 11px; display: block; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.s-勤務中 { background: var(--ok-bg); color: var(--ok); } .s-休憩中 { background: var(--brk-bg); color: var(--brk); }
.s-退勤済 { background: var(--done-bg); color: var(--done); } .s-退勤漏れ { background: var(--ng-bg); color: var(--ng); }
.s-未出勤 { background: var(--abs-bg); color: var(--abs); } .s-休暇 { background: var(--lv-bg); color: var(--lv); }
.tag { font-size: 11px; background: #eef2ff; color: #3730a3; border-radius: 4px; padding: 1px 6px; margin-left: 6px; }
.empty { padding: 28px; text-align: center; color: var(--sub); }
.count { color: var(--sub); font-size: 12px; margin: 0 0 8px; }
.err { color: var(--ng); }
.grid-wrap { overflow: auto; max-height: 68vh; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.grid-wrap table { width: max-content; }
.grid-wrap th, .grid-wrap td { padding: 5px 7px; font-size: 12px; text-align: center; border-right: 1px solid var(--line); }
.grid-wrap th { position: sticky; top: 0; z-index: 2; }
.grid-wrap th.l, .grid-wrap td.l { text-align: left; position: sticky; background: #fff; z-index: 1; }
.grid-wrap th.l { background: #f8fafc; z-index: 3; }
.grid-wrap td.c1 { left: 0; min-width: 130px; } .grid-wrap td.c2 { left: 130px; min-width: 110px; border-right: 2px solid #cbd5e1; }
.grid-wrap th.c1 { left: 0; } .grid-wrap th.c2 { left: 130px; border-right: 2px solid #cbd5e1; }
.grid-wrap th.sat { background: #dbeafe; color: #1d4ed8; } .grid-wrap th.sun { background: #fee2e2; color: #b91c1c; }
.grid-wrap td.we { background: #f8fafc; }
.grid-wrap td.miss { background: var(--ng-bg); color: var(--ng); font-weight: 700; }
.grid-wrap td.lv { background: var(--lv-bg); color: var(--lv); }
.grid-wrap td.sum { font-weight: 700; background: #fff; }
.grid-wrap td.sum.bad { color: var(--ng); }
.legend { font-size: 12px; color: var(--sub); margin: 8px 2px; display: flex; gap: 14px; flex-wrap: wrap; }
.legend em { font-style: normal; padding: 1px 6px; border-radius: 4px; }
.form { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; max-width: 560px; display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-size: 13px; color: var(--sub); }
.form select, .form input[type=text] { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--ink); }
.btn { background: var(--brand); color: #fff; border: 0; padding: 10px 16px; border-radius: 8px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; display: inline-block; text-align: center; }
.btn.wide { width: 100%; margin: 4px 0; }
.btn.sub { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.note { font-size: 12px; color: var(--sub); line-height: 1.7; }
.note.dev { background: #fff7d6; color: #7a5b00; padding: 6px 10px; border-radius: 6px; }
.people { display: grid; gap: 8px; max-height: 60vh; overflow: auto; }
.person { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; cursor: pointer; font: inherit; color: inherit; }
.person:hover, .person.sel { border-color: var(--brand); background: #f0f6ff; }
.person small { color: var(--sub); margin-left: 6px; }
.hist { display: grid; grid-template-columns: 280px 1fr; gap: 14px; }
.checks { display: flex; gap: 10px; flex-wrap: wrap; }
.checks label { display: inline-flex; flex-direction: row; align-items: center; gap: 4px; color: var(--ink); }
body.plain { background: var(--bg); }
.login { max-width: 420px; margin: 8vh auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.login h1 { margin: 0 0 8px; font-size: 20px; color: var(--brand); }
.hidden { display: none !important; }
@media (max-width: 760px) { .hist { grid-template-columns: 1fr; } main { padding: 12px 12px 40px; } th, td { padding: 8px 8px; } .hide-sm { display: none; } }
@media print { header, nav, .bar, .tiles { display: none; } body { background: #fff; } .grid-wrap { max-height: none; overflow: visible; } }

/* 月間表: 人ごとの総時間の一覧+カレンダー */
.month-split { display: grid; grid-template-columns: minmax(0, 1fr) 580px; gap: 14px; align-items: start; }
.sum-card { max-height: 72vh; }
.sum-card th.num, .sum-card td.num { text-align: right; white-space: nowrap; }
.sum-card td { white-space: normal; }
.sum-card tbody tr { cursor: pointer; }
.sum-card tbody tr:hover { background: #f0f6ff; }
.sum-card tbody tr.sel { background: #e4eefc; }
.sum-card td.hours { font-weight: 700; }
.sum-card td.bad { color: var(--ng); font-weight: 700; }
.cal-box { position: sticky; top: 8px; }
.cal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cal-head .totals b { font-size: 15px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 10px; }
.cal .wd { text-align: center; font-size: 11px; color: var(--sub); padding: 2px 0; }
.cal .wd.sat { color: #1d4ed8; } .cal .wd.sun { color: #b91c1c; }
.cal .day { min-height: 78px; border: 1px solid var(--line); border-radius: 6px; padding: 3px 4px; background: #fff; text-align: left; font: inherit; color: inherit; display: block; width: 100%; }
.cal .day.blank { border: 0; background: none; }
.cal button.day { cursor: pointer; }
.cal .day .n { font-size: 11px; color: var(--sub); display: block; }
.cal .day.sat .n { color: #1d4ed8; } .cal .day.sun .n { color: #b91c1c; }
/* 土日祝: 日付欄を横いっぱいの色の帯にする(勤怠・有休で背景色が付いても消えない) */
.cal .day.sat .n, .cal .day.sun .n, .cal .day.hol .n, .cal .day.co .n { margin: -3px -4px 3px; padding: 2px 4px; border-radius: 5px 5px 0 0; font-weight: 700; }
.cal .day.sat .n { background: #dbeafe; }
.cal .day.sun .n, .cal .day.hol .n { background: #fee2e2; color: #b91c1c; }
.cal .day.co .n { background: #fef3c7; color: #92400e; }
.dk { display: inline-block; font-size: 10px; font-weight: 700; line-height: 1.3; border-radius: 3px; padding: 0 4px; margin-left: 4px; color: #fff; }
.dk.sat { background: #2563eb; } .dk.sun, .dk.hol { background: #dc2626; } .dk.co { background: #d97706; }
.cal .oth.lng, .legend .oth.lng { background: #fde68a; color: #78350f; font-weight: 700; }
.legend em.dk { font-style: normal; margin-left: 2px; }
.cal .day .t { font-size: 10.5px; line-height: 1.35; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .day .h { font-size: 12px; font-weight: 700; display: block; }
.cal .day.st-done { background: #f1f5f9; }
.cal .day.st-working { background: var(--ok-bg); }
.cal .day.st-miss { background: var(--ng-bg); border-color: #fca5a5; }
.cal .day.st-leave { background: var(--lv-bg); }
.cal .day.sel { outline: 2px solid var(--brand); }
.cal .day .oth { font-size: 10px; background: #eef2ff; color: #3730a3; border-radius: 3px; padding: 0 3px; }
.day-detail { margin-top: 10px; }
.day-detail table th, .day-detail table td { padding: 6px 8px; font-size: 12px; white-space: normal; }
@media (max-width: 1200px) { .month-split { grid-template-columns: 1fr; } .cal-box { position: static; } }

/* 有休・公休 */
.s-有休 { background: var(--lv-bg); color: var(--lv); }
.s-有休-申請中 { background: #f5f6ff; color: var(--lv); border: 1px dashed #a5b4fc; }
.tile.k-lv b { color: var(--lv); }
.today-note { background: #fff7d6; color: #7a5b00; padding: 6px 10px; border-radius: 6px; margin: 0 0 10px; }
.cal .day.st-leave { background: var(--lv-bg); }
.cal .day.st-leave.pending { background: #f5f6ff; border: 1px dashed #818cf8; }
.cal .day.st-leave .t { color: var(--lv); font-weight: 700; }
.cal .day.st-off { background: #f3f4f6; color: #6b7280; }
.cal .day.st-off .t { font-weight: 700; }
.cal .day .sm { font-size: 9.5px; opacity: .85; }
.grid-wrap td.off { background: #f3f4f6; color: #6b7280; }
.grid-wrap td.pend { background: #f5f6ff; color: var(--lv); }
.grid-wrap th.hol { background: #fee2e2; color: #b91c1c; }
.sum-card td.lv { color: var(--lv); font-weight: 700; }

/* 欠勤・慶弔・代休 */
.s-休暇, .s-慶弔休暇, .s-代休 { background: #dbeafe; color: #1e40af; }
.s-欠勤 { background: #f3e8e8; color: #7f1d1d; }
.tile.k-abs2 b { color: #7f1d1d; }
.cal .day.st-absence { background: #f3e8e8; border-color: #e5b4b4; }
.cal .day.st-absence .t { color: #7f1d1d; font-weight: 700; }
.cal .day.st-special { background: #e0f2fe; }
.cal .day.st-special .t { color: #1e40af; font-weight: 700; }
.grid-wrap td.abs { background: #f3e8e8; color: #7f1d1d; font-weight: 700; }
.grid-wrap td.sp { background: #e0f2fe; color: #1e40af; }
.sum-card td.abs { color: #7f1d1d; font-weight: 700; }

/* ---- 2026-11-11 月間集計カレンダーを見やすく(伊藤さん依頼) ---- */
main { max-width: 1560px; }
.month-split { grid-template-columns: minmax(560px, 1fr) minmax(600px, 1.1fr); }
.cal { gap: 5px; }
.cal .wd { font-size: 13px; font-weight: 700; padding: 4px 0; }
.cal .day { min-height: 104px; padding: 4px 7px; }
.cal .day .n { font-size: 14px; font-weight: 700; color: var(--text, #1f2937); }
.cal .day .t { font-size: 12.5px; line-height: 1.5; }
.cal .day .sm { font-size: 11px; }
.cal .day .h { font-size: 15px; margin-top: 3px; }
.cal .day.sat .n, .cal .day.sun .n, .cal .day.hol .n, .cal .day.co .n { margin: -4px -7px 4px; padding: 3px 7px; }
.cal .day.sat .n { color: #1d4ed8; } .cal .day.sun .n, .cal .day.hol .n { color: #b91c1c; } .cal .day.co .n { color: #92400e; }
.cal .day .hn { display: block; font-size: 11px; font-weight: 600; line-height: 1.3; }
.cal .dk { font-size: 11px; padding: 0 5px; }
.cal .oth { font-size: 11px; }
.cal .day.st-miss .t, .cal .day.st-miss .h { color: #991b1b; }
/* 人×日の一覧: 土日祝の列は、勤怠・有休の色が付いても下線で分かる */
.grid-wrap td.wsat { box-shadow: inset 0 -3px 0 #60a5fa; } .grid-wrap td.wsun, .grid-wrap td.whol { box-shadow: inset 0 -3px 0 #f87171; }
.grid-wrap td.whol:not(.lv):not(.miss):not(.abs):not(.sp):not(.off):not(.pend) { background: #fef2f2; }
.grid-wrap td.wsun:not(.lv):not(.miss):not(.abs):not(.sp):not(.off):not(.pend) { background: #fef2f2; }
.grid-wrap td.wsat:not(.lv):not(.miss):not(.abs):not(.sp):not(.off):not(.pend) { background: #eff6ff; }
