/* ปุ่มเซ็น + โมดัลลายเซ็น (รองรับมือถือ/PDA) */
.btn-sign {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 12px 14px;
  border: none;
  border-radius: 8px;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  background: #1a5f2a;
  min-height: 48px;
}
.btn-sign:disabled {
  background: #9aaa9a;
  cursor: default;
}

.sig-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
.sig-modal[hidden] { display: none !important; }

.sig-panel {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  width: min(620px, 100%);
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.sig-panel h2 {
  margin: 0 0 10px;
  font-size: 1.1rem;
}
.sig-hint {
  display: none;
}
#sig_canvas {
  width: 100%;
  height: auto;
  border: 1px solid #ccc;
  border-radius: 4px;
  touch-action: none;
  background: #fff;
  cursor: crosshair;
  display: block;
}
.sig-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.sig-actions button {
  font: inherit;
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: #fff;
  background: #1a5f2a;
  min-height: 44px;
}
.sig-actions .btn-gray { background: #555; }

/* มือถือ/PDA: แผ่นเซ็นเกือบเต็มจอ — ไม่แสดงปุ่มนำทาง เหลือแค่เซ็น */
@media (max-width: 900px) {
  body.signing-open {
    overflow: hidden;
  }

  .toolbar {
    display: none !important;
  }

  .page {
    width: 100%;
    height: auto;
    min-height: 0;
    margin: 0;
    box-shadow: none;
    overflow: visible;
  }
  .sheet {
    width: 100%;
    height: auto;
    max-height: none;
    padding: 12px 10px 20px;
    overflow: visible;
    font-size: 14px;
  }
  .cut-line { display: none; }
  .logo { width: 40px; height: 40px; }
  .company-name { font-size: 12px; }
  .company-addr { font-size: 10px; }
  .title { font-size: 16px; margin: 10px 0 6px; }
  .approvals {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .btn-sign {
    padding: 18px 14px;
    font-size: 1.2rem;
    min-height: 56px;
    border-radius: 12px;
    margin-top: 14px;
  }

  .sig-modal {
    padding: 0;
    align-items: stretch;
    background: #111;
  }
  .sig-panel {
    width: 100%;
    height: 100%;
    max-width: none;
    border-radius: 0;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    box-shadow: none;
  }
  .sig-panel h2 {
    font-size: 1.25rem;
    text-align: center;
    margin: 4px 0 8px;
  }
  .sig-hint {
    display: block;
    text-align: center;
    color: #555;
    font-size: 0.95rem;
    margin: 0 0 8px;
  }
  #sig_canvas {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-height: 60vh;
    border: 2px solid #1a5f2a;
    border-radius: 12px;
  }
  .sig-actions {
    margin-top: 10px;
    gap: 8px;
  }
  .sig-actions button {
    flex: 1;
    padding: 16px 10px;
    font-size: 1.1rem;
    font-weight: 700;
    min-height: 54px;
    border-radius: 12px;
  }
}

@media print {
  .btn-sign,
  .sig-modal { display: none !important; }
}
