/* The official sheet beside the form: it fills in as you type.
   Wide screens: boxes on the left, the sheet on the right.
   Phones and tablets: "Fill in | See the sheet" switches between them. */
.sheet-toggle { display: none; }
.sheet-pane { display: none; }
body.has-sheet .sheet-pane { display: flex; flex-direction: column; min-width: 0; }
.sheet-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 2px 8px; }
.sheet-head strong { font-size: 15px; }
.sheet-status { color: #5F6368; font-size: 13px; }
.sheet-pages { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px; background: #DADBD6; border-radius: 12px; min-height: 240px; }
.sheet-page { display: block; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); max-width: 100%; height: auto; }

@media (min-width: 1180px) {
  body.has-sheet main.shell-page {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); column-gap: 20px; align-items: start; max-width: none;
  }
  body.has-sheet main.shell-page > .topbar { grid-column: 1 / -1; }
  body.has-sheet main.shell-page > #app { grid-column: 1; min-width: 0; }
  body.has-sheet .sheet-pane { grid-column: 2; grid-row: 2 / span 3; position: sticky; top: 12px; max-height: calc(100vh - 120px); }
  body.has-sheet .sheet-pages { overflow-y: auto; }
}
@media (max-width: 1179px) {
  body.has-sheet .sheet-toggle {
    display: flex; gap: 4px; padding: 4px; margin: 0 0 12px; background: #E9E8E2; border-radius: 12px; position: sticky; top: 8px; z-index: 20;
  }
  .sheet-toggle button { flex: 1; min-height: 44px; border: 0; border-radius: 9px; background: transparent; font: inherit; font-weight: 700; color: #33363A; cursor: pointer; }
  .sheet-toggle button[aria-selected="true"] { background: #fff; color: #B3141C; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
  body.has-sheet:not(.show-sheet) .sheet-pane { display: none; }
  body.has-sheet.show-sheet main.shell-page > #app { display: none; }
  body.has-sheet.show-sheet .sheet-pages { padding: 8px; }
}
/* weekly sheets: carry on or start another */
.week-choose { display: flex; flex-direction: column; gap: 12px; padding: 8px 4px; }
.week-choose h1 { margin: 0; font-size: 22px; }
.week-sheets { display: grid; gap: 10px; }
.week-sheet { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px 16px; border: 1px solid #D6D7CA; border-radius: 12px; background: #fff; font: inherit; text-align: left; cursor: pointer; }
.week-sheet strong { font-size: 17px; }
.week-sheet span { color: #5F6368; font-size: 14px; }
.week-sheet-new { border-style: dashed; background: transparent; }

/* hand-over: office -> foreman's phone -> sign-off */
.hand-note { margin: 10px 0 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid #d9d4c7; background: #fbf8ef; font-size: 15px; line-height: 1.45; }
.hand-note strong { display: inline-block; margin-right: 4px; }
.hand-field { background: #fff7d6; border-color: #e6c64a; }
.hand-out { background: #eef4ff; border-color: #b8cbef; }
.hand-signoff { background: #eaf6ec; border-color: #9fd0a9; }
.hand-seen { background: #f3f3f3; border-color: #d0d0d0; }
details.office-part { margin: 0 0 14px; border: 1px solid #e3ded2; border-radius: 12px; padding: 0 12px; background: #fff; }
details.office-part > summary { cursor: pointer; padding: 12px 0; font-weight: 600; }
.photo-field { display: grid; gap: 6px; position: relative; }
.photo-field .photo-input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.photo-field .photo-pick { justify-self: start; min-height: 48px; padding: 0 18px; display: inline-flex; align-items: center; }
.proof-photo { max-width: 100%; max-height: 320px; border-radius: 10px; border: 1px solid #ddd; object-fit: contain; background: #fafafa; }
@media (max-width: 640px) {
  .stickyBar .actionBar .btn { min-height: 48px; font-size: 16px; }
}
#app .photo-field label.photo-pick { display: inline-flex !important; align-items: center !important; justify-content: center; line-height: 1.2; padding: 12px 18px !important; min-height: 48px; margin: 0; }

/* phones: no sideways drift, and no zoom when a box is tapped (iPhone zooms under 16px) */
@media (max-width: 640px) {
  html, body { overflow-x: clip; max-width: 100%; }
  #app input, #app select, #app textarea { font-size: 16px; max-width: 100%; }
  #app .tableWrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* zooming the sheet (the boxes on the left stay as they are) */
.sheet-head { align-items: center; flex-wrap: wrap; }
.sheet-zoom { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
.sheet-zoom button { min-width: 34px; height: 32px; padding: 0 8px; border: 1px solid #D6D7CA; border-radius: 8px; background: #fff; font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; color: #17181A; }
.sheet-zoom button:disabled { opacity: .4; cursor: default; }
.sheet-zoom .sheet-full-btn { font-size: 13px; }
.sheet-zoom-level { min-width: 44px; text-align: center; font-size: 13px; font-weight: 700; color: #33363A; }
.sheet-pane.is-zoomed .sheet-pages { align-items: flex-start; overflow: auto; }
.sheet-page.zoomed { max-width: none; }
body.has-sheet .sheet-pane.sheet-full { position: fixed !important; inset: 0; top: 0 !important; z-index: 3000; background: #F5F5F3; padding: 12px 16px; max-height: none !important; display: flex !important; }
body.has-sheet .sheet-pane.sheet-full .sheet-pages { flex: 1; overflow: auto; max-height: none; }
html.sheet-full-open, html.sheet-full-open body { overflow: hidden; }
