/* =========================================================
   管理記録簿 - 印刷（PDF）用スタイル
   A4縦 / 2ページ / 裏表（長辺とじ）印刷を想定
   1ページ目は左、2ページ目は右にパンチ穴用の余白を確保
   ========================================================= */

@media print {

  @page {
    size: A4 portrait;
    margin: 8mm 8mm 10mm;
  }

  html, body {
    background: #fff !important;
    margin: 0;
    padding: 0;
  }

  /* アプリ画面は印刷しない */
  body > #login-screen,
  body > #app-screen {
    display: none !important;
  }

  #print-area {
    display: block !important;
    color: #000;
    font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
    font-size: 9pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .sheet {
    position: relative;
    break-after: page;
    page-break-after: always;
  }

  .sheet:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  /* パンチ穴用の余白（表面＝左とじ、裏面はミラーで右） */
  .sheet1 { padding-left: 18mm; padding-right: 2mm; }
  .sheet2 { padding-right: 18mm; padding-left: 2mm; }

  /* ---------- 1ページ目 ---------- */

  .sheet-title {
    margin: 0 0 4mm;
    font-size: 14pt;
    text-align: center;
    letter-spacing: .1em;
  }

  .sheet1-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8mm;
    margin-bottom: 4mm;
  }

  .ym {
    display: flex;
    align-items: baseline;
    gap: 2mm;
    border-bottom: 1.2pt solid #000;
    padding: 0 2mm 1.5mm;
  }

  .ym-num {
    font-size: 15pt;
    font-weight: 700;
    background: #fffde0;
    padding: 0 3mm;
  }

  .ym-unit { font-size: 10pt; }

  .ym-store {
    font-size: 11pt;
    font-weight: 700;
    margin-left: 6mm;
  }

  .check-box {
    border-collapse: collapse;
    min-width: 62mm;
  }

  .check-box th {
    background: #ffff00;
    border: .8pt solid #000;
    text-align: center;
    font-size: 9pt;
    padding: .6mm 2mm;
  }

  .check-box td {
    border: .8pt solid #000;
    padding: .6mm 2mm;
    font-size: 8.5pt;
  }

  /* ---------- 共通の表 ---------- */

  .p-grid {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    line-height: 1.15;
  }

  .p-grid th,
  .p-grid td {
    border: .8pt solid #000;
    padding: .4mm 1.4mm;
    vertical-align: middle;
    word-break: break-all;
    overflow-wrap: anywhere;
  }

  .p-grid thead th {
    background: #ffff00;
    text-align: center;
    font-weight: 700;
    height: 6mm;
  }

  .p-grid tbody td { height: 5.4mm; }

  .ta-c { text-align: center; }
  .ta-r { text-align: right; }

  /* 1ページ目の列幅 */
  .p-grid-1 .w-day { width: 9mm; background: #fff; }
  .p-grid-1 .w-wday { width: 9mm; background: #fff; }
  .p-grid-1 .w-hours { width: 30mm; }
  .p-grid-1 .w-count { width: 24mm; }
  .p-grid-1 .w-sign { width: 26mm; }
  .p-grid-1 tbody td:nth-child(3),
  .p-grid-1 tbody td:nth-child(4),
  .p-grid-1 tbody td:nth-child(5),
  .p-grid-1 tbody td:nth-child(6) { background: #fffde0; }

  /* ---------- 合計 ・ 管理者印 ---------- */

  .sheet1-foot {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8mm;
    margin-top: 0;
  }

  .total-box { border-collapse: collapse; }

  .total-box th {
    background: #ffff00;
    border: .8pt solid #000;
    padding: 1mm 3mm;
    width: 48mm;
    text-align: center;
  }

  .total-box td {
    border: .8pt solid #000;
    padding: 1mm 3mm;
    width: 26mm;
    background: #fff;
    font-weight: 700;
  }

  .manager-box {
    border-collapse: collapse;
    margin-top: 4mm;
    width: 38mm;
  }

  .manager-box th {
    border: .8pt solid #000;
    padding: .8mm;
    text-align: center;
    font-weight: 400;
  }

  .manager-box td {
    border: .8pt solid #000;
    height: 22mm;
    background: #fffde0;
    text-align: center;
    vertical-align: middle;
  }

  .manager-name { font-size: 10pt; }

  /* ---------- 2ページ目 ---------- */

  .sheet2 { padding-top: 18mm; }

  .p-grid-2 .w-date { width: 30mm; }
  .p-grid-2 .w-cat { width: 36mm; }

  .p-grid-2 tbody td {
    height: 26mm;
    vertical-align: top;
    background: #fffde0;
    padding: 1.5mm;
  }

  .p-grid-2 .content-cell { white-space: pre-wrap; }
}
