:root {
  --bg: #faf7f2; --fg: #2b2622; --muted: #7a6f66; --card: #fff; --line: #e6ddd2;
  --accent: #8a5a3b; --accent-fg: #fff; --error: #b3261e; --ok: #2e7d32; --warn-bg: #fff6e0;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.6 system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif; }
main { max-width: 960px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.4rem; margin: 8px 0 16px; }
h2 { font-size: 1.1rem; margin: 24px 0 8px; }
a { color: var(--accent); }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 16px; background: var(--accent); color: var(--accent-fg); }
.topbar a, .topbar button.link { color: var(--accent-fg); }
.brand { font-weight: bold; text-decoration: none; }
.who { margin-right: 8px; }
.inline { display: inline; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.card.warn { background: var(--warn-bg); }
.muted { color: var(--muted); }
.menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 16px 0; }
/* メニューのボタンは同じ高さ・文字は真ん中にそろえる */
.menu .button { display: flex; align-items: center; justify-content: center; }
.button, button { display: inline-block; padding: 12px 18px; min-height: 44px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-fg); font-size: 1rem; text-decoration: none; text-align: center; cursor: pointer; }
.button.secondary { background: var(--card); color: var(--accent); border: 1px solid var(--accent); }
button.link { background: none; padding: 0; min-height: 0; text-decoration: underline; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.list { list-style: none; padding: 0; margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.list li { padding: 12px 16px; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list li a { display: block; text-decoration: none; color: inherit; }
.list li.current { background: #f6efe6; }
.tag { display: inline-block; font-size: .8rem; padding: 0 8px; border-radius: 99px; background: var(--line); margin-left: 4px; }
.tag.on { background: #dcefdc; color: var(--ok); }
.fields { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
.fields dt { color: var(--muted); }
.fields dd { margin: 0; }
.field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 4px; }
.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea, select { font-size: 1rem; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; width: 100%; }
.checks > div { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.checks label { display: flex; align-items: center; gap: 4px; min-height: 36px; }
.checks input { width: 20px; height: 20px; flex: none; margin: 0; }
.req { font-size: .75rem; color: var(--error); }
.error { color: var(--error); }
.msg { padding: 10px 14px; border-radius: 8px; background: #eef5ee; }
.msg.error { background: #fdecea; }
.table-scroll { overflow-x: auto; margin-bottom: 12px; }
.matrix { border-collapse: collapse; background: var(--card); font-size: .9rem; }
.matrix th, .matrix td { border: 1px solid var(--line); padding: 6px 8px; white-space: nowrap; }
.matrix tbody th { white-space: normal; min-width: 6.5em; max-width: 8em; text-align: left; font-size: .8rem; position: sticky; left: 0; background: var(--card); }
.matrix thead th { position: sticky; top: 0; background: #f6efe6; font-size: .8rem; }
.matrix td.check { text-align: center; }
.matrix input[type=checkbox] { width: 22px; height: 22px; }
.month-nav { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.month-nav a { padding: 8px 0; }
.sheet { border-collapse: collapse; background: var(--card); font-size: .85rem; }
.sheet th, .sheet td { border: 1px solid var(--line); padding: 4px 6px; text-align: center; min-width: 2em; }
.sheet th.name { text-align: left; white-space: nowrap; position: sticky; left: 0; background: var(--card); z-index: 1; }
.sheet thead th { background: #f6efe6; }
.sheet th.weekend { background: #f0e2d2; }
.sheet td.total, .sheet tfoot td { font-weight: bold; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.inline-form select { width: auto; flex: 1 1 12em; }
button.small, .button.small { padding: 6px 12px; min-height: 36px; font-size: .9rem; margin-top: 6px; }
button.secondary-btn { background: var(--card); color: var(--accent); border: 1px solid var(--accent); }
button:disabled { opacity: .45; cursor: not-allowed; }
.tag.warn-tag { background: #fdecea; color: var(--error); }
.filter input[type=search] { flex: 1 1 12em; font-size: 1rem; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.filter select { width: auto; }
details.card summary { cursor: pointer; }
.list.days li.off { background: #f7f3ee; }
.punch-times { display: flex; gap: 24px; margin: 8px 0; }
.punch-times div { display: flex; flex-direction: column; }
.punch-times strong { font-size: 1.6rem; }
.punch-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.punch-buttons button { font-size: 1.2rem; min-height: 56px; }
details.request { margin-top: 6px; }
details.request summary { cursor: pointer; color: var(--accent); }
.inline-form label { display: flex; align-items: center; gap: 4px; }
.inline-form input[type=time], .inline-form input[type=text] { font-size: 1rem; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; }
.check-row input { width: 22px; height: 22px; margin-top: 2px; }
@media (max-width: 480px) {
  .fields { grid-template-columns: 1fr; }
  .fields dd { margin-bottom: 8px; }
}
/* 日付・時刻の入力欄：iPhone（Safari）では独自の幅を持ち、画面の右にはみ出すので、幅を枠に合わせる */
input[type=date], input[type=time], input[type=month], input[type=datetime-local] {
  -webkit-appearance: none; appearance: none;
  display: block; min-width: 0; max-width: 100%; min-height: 44px;
  font-family: inherit; text-align: left; color: inherit;
}
input[type=date]::-webkit-date-and-time-value, input[type=time]::-webkit-date-and-time-value,
input[type=month]::-webkit-date-and-time-value { text-align: left; }
.inline-form input[type=time] { display: inline-block; width: 8em; }
textarea { font-size: 1rem; padding: 10px; border: 1px solid var(--line); border-radius: 8px; width: 100%; font-family: inherit; line-height: 1.6; }
pre.sent { white-space: pre-wrap; font-size: .85rem; background: #f7f3ee; padding: 8px; border-radius: 6px; }
.observation { white-space: normal; }
.progress { height: 14px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 8px 0; }
.progress div { height: 100%; background: var(--accent); transition: width .8s ease; }
.list.records li { font-size: .95rem; }

/* 長い URL などが画面の右にはみ出さないように折り返す */
p, li, dd, td { overflow-wrap: break-word; }
input[type=file] { max-width: 100%; }

/* 報告書の一覧：チェックを付けてまとめて選ぶ */
.pick-row { display: flex; gap: 10px; align-items: flex-start; }
.pick-row > input[type=checkbox] { width: 22px; height: 22px; margin-top: 4px; flex: none; }
.pick-row > a { flex: 1; }
.batch-bar { display: flex; flex-direction: column; gap: 8px; }
.batch-list li { display: flex; justify-content: space-between; gap: 8px; }
