/* The complete A5 stays visible; editing uses a readable, unscaled field. */
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
.paper-field-active { background:#e8f7fa !important; outline:2px solid #278d99 !important; outline-offset:1px; }
.sheet-camera { position:relative; display:grid; place-items:center; width:42px; height:42px; flex-shrink:0; border:1px solid #b5d0d3; border-radius:9px; color:#0c6a70; background:#fff; cursor:pointer; }
.sheet-camera svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linejoin:round; }
.sheet-camera span { position:absolute; right:-3px; top:-4px; border-radius:50%; padding:1px 5px; background:#0c6a70; color:white; font-size:11px; }
.sheet-edit-panel { border-top:1px solid #d8e4e3; background:#f4faf9; padding:8px 16px; }
#sheetFieldPicker { width:100%; height:40px; padding:6px 9px; margin-bottom:4px; border:1px solid #b5d0d3; border-radius:6px; background:white; font:16px Arial,sans-serif; color:#0a4854; }
.sheet-edit-panel p { margin:0; font-size:14px; line-height:1.4; }
.sheet-edit-panel [role=alert]:empty { display:none; }
.sheet-edit-panel [role=alert]:not(:empty) { color:#9f2828; margin-top:5px; }
.sheet-editor-title { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:3px; }
.sheet-editor-title label { font-size:15px; font-weight:700; color:#0a4854; }
.sheet-editor-title > div { display:flex; gap:5px; }
.sheet-editor-title button { min-width:40px; height:36px; border:1px solid #b4cdcf; border-radius:6px; background:white; color:#0c6a70; font-size:15px; cursor:pointer; }
#sheetEditControl input:not([type=checkbox]):not([type=radio]), #sheetEditControl select, #sheetEditControl textarea { width:100%; min-height:44px; border:1px solid #82adb3; border-radius:7px; padding:8px 10px; font:17px/1.4 Arial,sans-serif; color:#123457; background:white; }
#sheetEditControl textarea { height:72px; resize:none; }
#sheetEditControl input[type=checkbox], #sheetEditControl input[type=radio] { height:24px; width:24px; margin:8px 0; accent-color:#0c6a70; }
.dive-photo-draft { display:flex; gap:10px; align-items:center; flex-wrap:wrap; padding-top:5px; }
.dive-photo-draft[hidden], #sheetFieldEditor[hidden], #sheetEditHint[hidden] { display:none; }
.dive-photo-draft button { border:0; background:none; color:#0c6a70; text-decoration:underline; min-height:32px; font-size:13px; cursor:pointer; }
.dive-photo-draft span { font-size:12px; color:#516e75; }
#divePhotoImage { display:block; width:100%; max-height:65dvh; object-fit:contain; }
#divePhotoImage[hidden] { display:none; }
@media screen {
  #diveDialog.sheet-dialog { position:fixed; inset:auto; top:calc(var(--visual-offset,0px) + 8px); left:50%; transform:translateX(-50%); margin:0; width:min(1100px,calc(100vw - 16px)); max-width:calc(100vw - 16px); height:calc(var(--visual-height,100dvh) - 16px); max-height:none; overflow:hidden; }
  #diveForm { height:100%; display:grid; grid-template-rows:auto minmax(0,1fr) auto auto; }
  #diveDialog .dialog-head { position:static; padding:8px 14px; min-height:59px; }
  #diveDialog .dialog-head .eyebrow { font-size:9px; margin:0 0 2px; }
  #diveDialog .dialog-head h2 { font-size:18px; }
  #diveDialog .dialog-head-actions { gap:8px; }
  #diveDialog #manualDiveNumberBtn { display:block; font-size:12px; padding:8px 10px; min-height:36px; max-width:none; }
  #diveDialog .dialog-actions { position:static; padding:8px 14px; flex-wrap:nowrap; min-height:58px; }
  #diveDialog .dialog-actions > span { font-size:12px; flex-basis:auto; }
  #diveDialog .dialog-actions button { flex:none; min-height:40px; }
  .sheet-workspace { min-height:0; min-width:0; overflow:hidden; display:flex; align-items:center; justify-content:center; padding:8px 12px; background:#eaf2f2; }
  .sheet-canvas { position:relative; flex-shrink:0; }
  #diveDialog .a5-sheet { position:absolute; left:0; top:0; width:740px; max-width:none; min-height:1050px; height:1050px; margin:0; padding:20px 28px 14px; transform:scale(var(--sheet-scale,1)); transform-origin:top left; }
  /* Keep the paper geometry on every viewport, overriding the old mobile reflow. */
  #diveDialog .a5-sheet label, #diveDialog .a5-sheet span, #diveDialog .a5-sheet legend { font-size:12px; }
  #diveDialog .a5-sheet input, #diveDialog .a5-sheet select, #diveDialog .a5-sheet textarea { font-size:14px; min-height:0; height:27px; padding:3px 2px 4px; }
  #diveDialog .a5-sheet .paper-inline { align-items:center; white-space:nowrap; gap:5px; }
  #diveDialog .paper-title { font-size:54px; margin:0 0 12px; }
  #diveDialog .paper-heading { grid-template-columns:1fr 1fr; gap:20px; }
  #diveDialog .paper-upper { grid-template-columns:1.55fr 1fr; gap:24px; margin-top:18px; }
  #diveDialog .profile-top-fields label:last-child { margin-left:34px; }
  #diveDialog .profile-values { grid-template-columns:1fr 1fr 1fr; gap:15px; }
  #diveDialog .profile-values > label { font-size:10px; }
  #diveDialog .profile-values > label input { font-size:22px; height:35px; }
  #diveDialog .profile-technical { grid-column:auto; grid-template-columns:1fr; gap:3px; }
  #diveDialog .profile-technical input { height:22px; }
  #diveDialog .profile-technical label { font-size:11px; }
  #diveDialog .profile-stop-row { margin:8px 0 10px; }
  #diveDialog .profile-stop-row input[type=number] { min-width:0; width:32px; height:24px; }
  #diveDialog .paper-options { gap:10px; margin-top:10px; }
  #diveDialog .paper-options legend { margin-bottom:5px; }
  #diveDialog .a5-sheet .paper-check { min-height:0; font-size:11px; gap:5px; margin:5px 0; }
  #diveDialog .a5-sheet .paper-check input { width:12px; height:12px; min-height:0; flex-basis:12px; margin:0; padding:0; }
  #diveDialog .paper-methods { grid-template-columns:1fr 1.2fr; gap:25px; margin:12px 0 10px; }
  #diveDialog .paper-methods > div { gap:4px; }
  #diveDialog .paper-methods .paper-inline { font-size:11px; }
  #diveDialog .paper-field-pair { grid-template-columns:1fr 1.1fr; gap:8px; }
  #diveDialog .paper-gas-rows { gap:5px; }
  #diveDialog .paper-gas-row { grid-template-columns:1fr 1.2fr; gap:25px; padding:0; border:0; }
  #diveDialog .paper-gas-row > span, #diveDialog .paper-gas-row label, #diveDialog .paper-gas-row small { font-size:10px; }
  #diveDialog .paper-gas-row input { height:24px; }
  #diveDialog .paper-scrubber { flex-wrap:nowrap; justify-content:flex-end; gap:7px; }
  #diveDialog .paper-scrubber > span { flex-basis:auto; }
  #diveDialog .paper-scrubber span, #diveDialog .paper-scrubber label { font-size:10px; }
  #diveDialog .paper-scrubber input { max-width:45px; height:24px; }
  #diveDialog .paper-memories { grid-template-columns:1.9fr 1fr; gap:18px; margin-top:14px; }
  #diveDialog .paper-comments { font-size:20px; }
  #diveDialog .paper-comments textarea { height:100px; min-height:0; line-height:25px; padding:0 3px; resize:none; background-size:100% 25px; background-image:linear-gradient(to bottom,transparent 0,transparent 24px,#92979b 24px,#92979b 25px); }
  #diveDialog .paper-stamp { min-height:0; padding:13px; }
  #diveDialog .paper-bottom { grid-template-columns:1.5fr 1fr; gap:24px; margin-top:14px; }
  #diveDialog .paper-bottom > div:first-child { gap:5px; }
  #diveDialog .paper-bottom > div:first-child .paper-inline { display:grid; grid-template-columns:183px minmax(0,1fr); font-size:14px; }
  #diveDialog .paper-bottom > div:first-child input { width:100%; }
  #diveDialog .paper-buddy { margin-top:10px; }
  #diveDialog .paper-credit { margin-top:4px; }
}
@media screen and (max-width:680px) {
  #diveDialog .dialog-head { padding:6px 10px; }
  #diveDialog .dialog-head h2 { font-size:16px; }
  #diveDialog #manualDiveNumberBtn { max-width:112px; font-size:11px; padding:5px 7px; }
  #diveDialog .dialog-head-actions { gap:5px; }
  #diveDialog .dialog-actions { padding:6px 10px; gap:7px; }
  #diveDialog .dialog-actions > span { display:none; }
  #diveDialog .dialog-actions button { flex:1; }
  .sheet-edit-panel { padding:6px 10px; }
  .sheet-edit-panel p { font-size:12px; }
}
