* { box-sizing: border-box; margin: 0; }
body { font-family: "Hiragino Sans", "Yu Gothic", sans-serif; background: #f5f5f5; }
.hidden { display: none !important; }
.screen { max-width: 1100px; margin: 0 auto; padding: 12px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 0; }
button { padding: 8px 14px; border: 1px solid #888; border-radius: 6px; background: #fff; font-size: 15px; }
button.secondary { background: #eee; }
#screen-login { max-width: 360px; display: flex; flex-direction: column; gap: 10px; padding-top: 60px; }
#screen-login input { padding: 10px; font-size: 16px; }
#edit-sheet { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; }
#edit-sheet .sheet-inner { background: #fff; width: 100%; max-height: 80vh; overflow-y: auto;
  border-radius: 16px 16px 0 0; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.sheet-buttons { display: flex; gap: 8px; }
#print-area { position: absolute; left: -20000px; top: 0; }

/* Excel再現カレンダー */
.cal { width: 100%; border-collapse: collapse; background: #fff; table-layout: fixed; }
.cal th, .cal td { border: 1px solid #000; }
.cal thead th { background: #595959; color: #fff; padding: 4px; font-size: 14px; }
.cal thead th.sun { background: #e0301e; }
.cal thead th.sat { background: #4ba6dd; }
.cal .date-row td { background: #f7e5e0; font-style: italic; font-weight: bold;
  font-size: 12px; text-align: center; padding: 2px; }
.cal .date-row td.sun { color: #c00000; }
.cal .date-row td.sat { color: #1565c0; }
.cal .body-row td { height: 92px; vertical-align: top; text-align: center;
  font-size: 12px; padding: 4px 2px; }
.cal td.other-month { color: #bbb; background: #fafafa; }
.cal .job { margin: 6px 0; }
.cal .toll { margin-top: 6px; }
.cal .body-row td.tappable { cursor: pointer; }
.wt-option { display: block; padding: 10px 4px; font-size: 16px; border-bottom: 1px solid #eee; }

/* 集計表 */
.summary { border-collapse: collapse; background: #fff; min-width: 420px; }
.summary th, .summary td { border: 1px solid #000; padding: 6px 10px; font-size: 14px; }
.summary thead th { background: #595959; color: #fff; }
.summary td.num { text-align: right; }
.summary tr.total td { font-weight: bold; background: #e8f5e9; }

/* 提出用（JPEG出力）レイアウト */
.print-sheet { width: 1024px; background: #fff; padding: 16px; }
.print-sheet .print-header { display: flex; justify-content: space-between; align-items: baseline; }
.print-sheet .print-header .m { font-size: 32px; font-weight: bold; }
.print-sheet .print-header .y { font-size: 28px; }
.print-sheet .cal .body-row td { height: 96px; }

/* 画面用: 1日枠の3段をチップで見せる（提出用JPEGには効かせない） */
#calendar-grid .cal .body-row td { padding: 3px; }
#calendar-grid .cal .cell { display: flex; flex-direction: column; height: 100%; min-height: 86px; gap: 3px; }
#calendar-grid .cal .job { margin: 0; padding: 4px 6px; border-radius: 6px; text-align: center;
  background: #eaf1f8; font-size: 12px; line-height: 1.3; }
#calendar-grid .cal .job:nth-child(2) { background: #eaf6ee; }
#calendar-grid .cal .job:nth-child(3) { background: #f3eef8; }
#calendar-grid .cal .toll { margin-top: auto; align-self: flex-end;
  background: #fff6dd; border: 1px solid #e3c56a; border-radius: 10px;
  padding: 1px 8px; font-size: 11px; color: #7a5c00; }
#calendar-grid .cal .toll::before { content: "¥"; margin-right: 1px; }

/* 提出用はExcel風のまま（チップ装飾を打ち消し） */
.print-sheet .cal .cell { display: block; }

/* チップは改行させず1行で収める */
#calendar-grid .cal .job { font-size: 12px; padding: 4px 6px; white-space: nowrap; }

/* 空の日は「＋」で入力できることを示す */
#calendar-grid .cal td.tappable .cell:empty::before {
  content: '＋'; margin: auto; color: #c5ccd4; font-size: 22px; font-weight: 300;
}
#calendar-grid .cal td.tappable:hover { background: #f0f6fc; }
#calendar-grid .cal td.tappable:active { background: #e2eefb; }

/* ETC照合 */
.etc-title { margin: 18px 0 6px; font-size: 15px; }
.summary input.etc-count { width: 64px; padding: 4px; font-size: 14px; text-align: right; }

/* マスタ画面 */
#master-content h3 { margin: 18px 0 6px; font-size: 15px; }
.summary.master input { padding: 4px 6px; font-size: 14px; border: 1px solid #ccc; border-radius: 4px; }
.summary.master input[type="number"] { width: 80px; text-align: right; }
.summary.master .wt-name, .summary.master .etc-name { width: 180px; }
.pat-option { display: inline-block; margin: 2px 8px 2px 0; font-size: 13px; white-space: nowrap; }
.pat-day { font-weight: bold; text-align: center; }
.pat-works { max-width: 520px; }
button.logout { margin-top: 24px; color: #b00; }
#master-content { padding-bottom: 12px; }

/* 請求書スタイルの集計 */
.summary tr.subtotal td { background: #f4f6f8; }
.summary tr.subtotal.strong td { font-weight: bold; }
.summary tr.offset td { background: #fbf7ee; }
.wt-option .wt-custom { width: 110px; margin-left: 8px; padding: 4px 6px; font-size: 14px;
  border: 1px solid #ccc; border-radius: 4px; }

/* スマホ: Excel同様にPC幅のまま描画し、スクロール＋ピンチ拡大縮小で見る */
#calendar-grid { overflow: auto; -webkit-overflow-scrolling: touch; }
#calendar-grid .cal { min-width: 900px; }
#summary-table { overflow-x: auto; }
.wt-move { white-space: nowrap; }
.wt-move button { padding: 4px 8px; font-size: 13px; }
.hint { color: #777; font-size: 12px; margin: 2px 0 6px; }
