:root {
  --paper-bg: #e9e6df; --paper: #fcfbf8; --card: #fff;
  --ink: #22252b; --ink-strong: #1b1d24; --ink-soft: #6f6a60; --ink-faint: #8a8577;
  --line: #e3ded2; --line-strong: #cbc4b4; --line-row: #eae4d7;
  --accent: #1f5a48; --accent-dark: #163f33; --marker: #ffe94d;
  --ng: #b31f34; --ng-soft: #d7b3ba; --ng-fill: #fbe3e6; --focus: #1b7f9e;
  /* 勤務の塗り。深夜だけ濃くして夜が並ぶ所を一目で分かるようにする */
  --s-A: #dcefe5; --s-B: #fcefc4; --s-C: #2b2e35; --s-off: #f1eee7;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
:where(button, a, input, select):focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
body { min-height: 100vh; background: var(--paper-bg); color: var(--ink); font-size: 17px; line-height: 1.6;
  font-family: "Hiragino Sans", "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif; }
.shell { width: 100%; max-width: 480px; margin: 0 auto; background: var(--paper); min-height: 100vh;
  box-shadow: 0 0 26px rgba(30, 25, 15, .10); padding: 20px 16px 40px; }
header h1 { margin: 6px 0 4px; font-size: 24px; color: var(--ink-strong); line-height: 1.35; }
header p { margin: 0 0 18px; color: var(--ink-soft); font-size: 15px; }
.tape { display: inline-block; padding: 5px 12px 4px; background: var(--accent); color: #fff; font-size: 13px;
  font-weight: 800; letter-spacing: .06em; border-radius: 3px; transform: rotate(-1.2deg); }
.marked { background: linear-gradient(transparent 66%, var(--marker) 66%); padding: 0 3px; }
.card { margin: 0 0 18px; padding: 17px 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 1px 2px rgba(40, 32, 15, .04), 0 6px 18px rgba(40, 32, 15, .06); }
.card h2 { display: flex; align-items: center; gap: 9px; margin: 0 0 15px; padding: 0 0 10px; color: var(--ink-strong);
  font-size: 15px; font-weight: 900; letter-spacing: .04em; border-bottom: 2px solid var(--ink-strong); }
.card h2::before { content: ""; width: 8px; height: 16px; background: var(--accent); border-radius: 1px; }
label, .label-row, legend { display: block; font-size: 14px; font-weight: 700; color: var(--ink-soft); margin: 10px 0 4px; padding: 0; }
fieldset { border: 0; margin: 0; padding: 0; }
input, select { width: 100%; min-height: 44px; padding: 9px 12px; border: 2px solid var(--line-strong); border-radius: 9px;
  background: #fdfcf9; color: var(--ink); font-weight: 700; }
input::placeholder { color: var(--ink-faint); opacity: 1; }
.num { font-variant-numeric: tabular-nums; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid3 label { margin-top: 0; }
button { min-height: 44px; padding: 9px 14px; border: 1.5px solid var(--line-strong); border-radius: 9px; background: var(--card);
  color: var(--ink-strong); font-weight: 800; transition: transform .04s; }
button:active { transform: translateY(1px); }
button.primary { background: var(--accent); border-color: var(--accent-dark); color: #fff; width: 100%; margin-top: 14px; }
button.danger { color: var(--ng); border-color: var(--ng-soft); }
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.weekdays button { padding: 0; min-width: 0; }
.weekdays button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent-dark); color: #fff; }

.person { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line-row); }
.person:last-child { border-bottom: 0; }
.person .who { flex: 1; min-width: 0; }
.person .who b { display: block; color: var(--ink-strong); overflow-wrap: anywhere; }
.person .who small { color: var(--ink-soft); font-size: 13px; }
.person input { width: 96px; flex: none; min-height: 44px; font-size: 14px; }
.person button { flex: none; }
.chip { display: inline-block; padding: 0 7px; margin-left: 6px; border-radius: 5px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 800; vertical-align: 2px; }
.empty { color: var(--ink-soft); font-size: 15px; margin: 12px 0 0; }

#summary { margin: 14px 0 8px; font-weight: 800; color: var(--ink-strong); }
#summary.ok { color: var(--accent-dark); }
#summary.ng { color: var(--ng); }
#issues ul { margin: 0 0 12px; padding-left: 1.2em; font-size: 14px; color: var(--ink); }
#issues li { margin-bottom: 3px; }
#issues details { margin-bottom: 12px; }
#issues summary { cursor: pointer; font-weight: 700; color: var(--ink-soft); min-height: 44px; display: flex; align-items: center; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; margin: 8px 0; }
table { border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { border-right: 1px solid var(--line-row); border-bottom: 1px solid var(--line-row); text-align: center; padding: 0; }
thead th { background: #f6f3ec; font-weight: 700; color: var(--ink-soft); padding: 4px 0; min-width: 34px; }
thead th.sun { color: var(--ng); }
thead th small { display: block; font-size: 11px; }
th.name { position: sticky; left: 0; z-index: 1; background: var(--card); text-align: left; padding: 0 8px; min-width: 76px;
  max-width: 96px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-strong); }
thead th.name { background: #f6f3ec; }
td button { width: 34px; min-height: 40px; padding: 0; border: 0; border-radius: 0; font-weight: 800; font-size: 14px; }
td button.s-A { background: var(--s-A); color: var(--ink-strong); }
td button.s-B { background: var(--s-B); color: var(--ink-strong); }
td button.s-C { background: var(--s-C); color: #fff; }
td button.s-off { background: var(--s-off); color: var(--ink-soft); }
td button.bad { background: var(--ng-fill); color: var(--ng); box-shadow: inset 0 0 0 2px var(--ng); }
tfoot td { font-size: 11px; color: var(--ink-soft); padding: 2px 0; line-height: 1.3; }
tfoot td.bad { background: var(--ng-fill); color: var(--ng); font-weight: 800; }
tfoot th.name { font-size: 12px; font-weight: 700; color: var(--ink-soft); }

.tools { display: flex; gap: 8px; margin-top: 8px; }
.tools button { flex: 1; white-space: nowrap; }
.note { font-size: 13px; color: var(--ink-soft); margin: 8px 0 0; }
.lead { margin: 0 0 12px; }
.linkbtn { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 14px; border-radius: 9px;
  background: var(--accent); border: 1.5px solid var(--accent-dark); color: #fff; font-weight: 800; text-decoration: none; }
footer { font-size: 13px; color: var(--ink-soft); margin-top: 10px; }

@media print {
  @page { size: A4 landscape; margin: 8mm; }
  body { background: #fff; }
  .shell { max-width: none; box-shadow: none; padding: 0; }
  header p, .card:not(:has(#table-wrap)), footer, .note, .tools, #make, #issues details { display: none !important; }
  .card { border: 0; box-shadow: none; padding: 0; }
  .table-wrap { overflow: visible; border: 0; }
  table { font-size: 9px; width: 100%; }
  td button { width: auto; min-width: 18px; min-height: 18px; font-size: 10px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  thead th { min-width: 0; }
}
